1.9 KiB
Executable file
fzf_theme Script Usage
Overview
The fzf_theme script configures the fzf color theme based on the system's appearance mode (Light or Dark). It is compatible with macOS and Linux systems, adjusting the fzf theme colors to ensure optimal visibility and aesthetics.
Usage
Basic Usage
To automatically detect the system's appearance mode and apply the corresponding fzf theme, run:
./fzf_theme.sh
Custom Appearance Mode
To override the automatic detection and set a specific appearance mode, provide either Light or Dark as an argument:
./fzf_theme.sh Light
or
./fzf_theme.sh Dark
Example
To use the script's output for configuring fzf, you can capture the FZF_DEFAULT_OPTS and use it as follows:
export FZF_DEFAULT_OPTS="$(./fzf_theme.sh)"
fzf --preview "echo 'Preview content'"
System Compatibility
macOS
- Detects system appearance using the
defaultscommand - Reads
AppleInterfaceStyleto determine Dark mode
Linux
The script attempts to detect the desktop environment in the following order:
- GNOME/GTK: Uses
gsettingsto read thegtk-theme - KDE Plasma: Uses
kreadconfig5to read the color scheme - Other (xsettingsd): Checks
~/.config/xsettingsd/xsettingsd.conf
Fallbacks: If automatic detection fails, the script checks environment variables:
GTK_THEMEQT_STYLE_OVERRIDE
If no theme can be detected, the script defaults to Dark mode.
Dependencies
fzf: Ensurefzfis installed and configured in your environment to utilize the output of this script.
Notes
- For persistent use, consider adding the script to your shell initialization file to automatically set the
fzftheme in new terminal sessions. - The script also defaults to Dark mode when running inside tmux (regardless of system appearance).