switch to rose pine to cover both light and dark themes
This commit is contained in:
61
scripts/hcf/rose_pine_switch
Executable file
61
scripts/hcf/rose_pine_switch
Executable 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
|
||||
Reference in New Issue
Block a user