1
0

switch to rose pine to cover both light and dark themes

This commit is contained in:
2025-04-01 18:41:25 +02:00
parent 2c50bc303b
commit b0cbc93c8a
10 changed files with 411 additions and 75 deletions

61
scripts/hcf/rose_pine_switch Executable file
View File

@@ -0,0 +1,61 @@
#!/bin/bash
# Script to switch the alacritty theme between rose-pine and rose-pine-dawn
#
# ./rose_pine_switch
set -euo pipefail
case "$(uname -s)" in
Linux*)
sed_command="sed -i"
;;
Darwin*)
sed_command="sed -i ''"
;;
*)
echo "Unknown platform"
return 1
;;
esac
function switch_alacritty_colors() {
local config_file
config_file="$DOTFILES/alacritty/.config/alacritty/alacritty.toml"
if ! grep -q 'colors' "$config_file"; then
echo "Error, could not find import from colors directory"
return 1
fi
if grep -q 'dawn' "$config_file"; then
$sed_command 's/rose-pine-dawn\.toml/rose-pine.toml/g' "$config_file"
else
$sed_command 's/rose-pine\.toml/rose-pine-dawn.toml/g' "$config_file"
fi
}
function switch_tmux_colors() {
local config_file
config_file="$DOTFILES/tmux/.tmux.conf"
if ! grep -q 'rose_pine_variant' "$config_file"; then
echo "Error, could not find rose pine settings in config file"
return 1
fi
if grep -q '@rose_pine_variant '\''dawn'\''' "$config_file"; then
$sed_command 's/rose_pine_variant '\''dawn'\''/rose_pine_variant '\''main'\''/g' "$config_file"
tmux source-file ~/.tmux.conf
else
$sed_command 's/rose_pine_variant '\''main'\''/rose_pine_variant '\''dawn'\''/g' "$config_file"
tmux source-file ~/.tmux.conf
fi
}
function switch_colors() {
# Only work if the DOTFILES variable is set
if [ -n "$DOTFILES" ]; then
switch_alacritty_colors
switch_tmux_colors
fi
}
switch_colors