add bash fn to toggle kitty term theme

This commit is contained in:
jc 2024-06-06 15:12:07 -04:00
commit 1a5ad084ce
No known key found for this signature in database
2 changed files with 17 additions and 5 deletions

View file

@ -198,8 +198,18 @@ else
fi fi
unset color_prompt unset color_prompt
# setup kitty # setup kitty, it will export TERM_COLOR_MODE (can be light or dark)
~/.config/kitty/setup.sh source ~/.config/kitty/setup.sh
# function to toggle kitty terminal theme
toggle_theme() {
if [ "$TERM_COLOR_MODE" == "light" ]; then
export TERM_COLOR_MODE=dark
kitten @ set-colors --all "$HOME/.config/kitty/dark.conf"
else
export TERM_COLOR_MODE=light
kitten @ set-colors --all "$HOME/.config/kitty/light.conf"
fi
}
type -p curl >/dev/null || echo -e "$WARNING curl is not installed" type -p curl >/dev/null || echo -e "$WARNING curl is not installed"

View file

@ -9,12 +9,14 @@ CURRENT_HOUR=$(date +"%H")
SEVEN_AM=7 SEVEN_AM=7
SEVEN_PM=19 SEVEN_PM=19
MODE=dark TERM_COLOR_MODE=dark
if [ $CURRENT_HOUR -ge $SEVEN_AM ] && [ $CURRENT_HOUR -lt $SEVEN_PM ]; then if [ $CURRENT_HOUR -ge $SEVEN_AM ] && [ $CURRENT_HOUR -lt $SEVEN_PM ]; then
MODE=light TERM_COLOR_MODE=light
fi fi
if [ $MODE == "light" ]; then if [ $TERM_COLOR_MODE == "light" ]; then
kitten @ set-colors --all "$HOME/.config/kitty/light.conf" kitten @ set-colors --all "$HOME/.config/kitty/light.conf"
else else
kitten @ set-colors --all "$HOME/.config/kitty/dark.conf" kitten @ set-colors --all "$HOME/.config/kitty/dark.conf"
fi fi
export TERM_COLOR_MODE