34 lines
1.2 KiB
Bash
Executable file
34 lines
1.2 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
set_fzf_theme() {
|
|
local appearance="$1"
|
|
|
|
# Detect the current system appearance (Light or Dark mode) for Linux and macOS
|
|
if [[ -z "$appearance" ]]; then
|
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
# macOS
|
|
appearance=$(defaults read -g AppleInterfaceStyle 2>/dev/null)
|
|
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
|
# Linux (assuming GNOME)
|
|
appearance=$(gsettings get org.gnome.desktop.interface gtk-theme 2>/dev/null)
|
|
else
|
|
# Default to Dark mode if the system is not recognized
|
|
appearance="Dark"
|
|
fi
|
|
fi
|
|
|
|
# Set fzf theme based on appearance
|
|
if [[ $appearance == *"Dark"* || -n "$TMUX" ]]; then
|
|
FZF_DEFAULT_OPTS="--color=bg+:#272822,bg:#272822,spinner:#f92672,hl:#66d9ee,fg:#f8f8f2,header:#f92672,info:#66d9ee,pointer:#a6e22e,marker:#a6e22e,fg+:#f8f8f2,prompt:#66d9ee,hl+:#66d9ee"
|
|
else
|
|
FZF_DEFAULT_OPTS="--color=bg+:#fdf6e3,bg:#fdf6e3,spinner:#d33682,hl:#b58900,fg:#657b83,header:#d33682,info:#268bd2,pointer:#859900,marker:#859900,fg+:#657b83,prompt:#268bd2,hl+:#b58900"
|
|
fi
|
|
|
|
# export FZF_DEFAULT_OPTS
|
|
|
|
echo "$FZF_DEFAULT_OPTS"
|
|
}
|
|
|
|
# Call the function to set FZF_DEFAULT_OPTS
|
|
set_fzf_theme "$1"
|
|
|