Automate switching between day/night color schemes
This sets up individual light and dark color scheme files for vim/neovim and alacritty, adds a script (`set-color`) for placing them, and includes two no-arg scripts for later keybinding (`day-mode` and `night-mode`). Thanks to this blog post for the idea to `cat` the YAML into place: https://shuheikagawa.com/blog/2020/02/14/switching-colorschemes-of-vim-and-alacritty/ TIL YAML is concatenative!
This commit is contained in:
parent
48ba022ae7
commit
be5708c8c7
14 changed files with 165 additions and 60 deletions
4
bin/day-mode
Executable file
4
bin/day-mode
Executable file
|
|
@ -0,0 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
CURDIR="$(cd "$(dirname "$(realpath "${BASH_SOURCE[0]}")")" && pwd)"
|
||||
exec "${CURDIR}/set-colors" light
|
||||
4
bin/night-mode
Executable file
4
bin/night-mode
Executable file
|
|
@ -0,0 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
CURDIR="$(cd "$(dirname "$(realpath "${BASH_SOURCE[0]}")")" && pwd)"
|
||||
exec "${CURDIR}/set-colors" dark
|
||||
20
bin/set-colors
Executable file
20
bin/set-colors
Executable file
|
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# "Automate" flipping applications between light and dark themes.
|
||||
|
||||
DOTFILES="$(cd "$(dirname "$(dirname "$(realpath "${BASH_SOURCE[0]}")")")" && pwd)"
|
||||
|
||||
scheme="${1:-dark}"
|
||||
|
||||
if [ "${scheme}" = 'dark' ]; then
|
||||
ln -sf "${DOTFILES}/alacritty/colors-dark.yml" "${DOTFILES}/alacritty/colors.yml"
|
||||
ln -sf "${DOTFILES}/vim/colors/jdkaplan-dark.vim" "${DOTFILES}/vim/colors/jdkaplan.vim"
|
||||
"${DOTFILES}/alacritty/install"
|
||||
elif [ "${scheme}" = 'light' ]; then
|
||||
ln -sf "${DOTFILES}/alacritty/colors-light.yml" "${DOTFILES}/alacritty/colors.yml"
|
||||
ln -sf "${DOTFILES}/vim/colors/jdkaplan-light.vim" "${DOTFILES}/vim/colors/jdkaplan.vim"
|
||||
"${DOTFILES}/alacritty/install"
|
||||
else
|
||||
echo "Unknown color scheme: ${scheme}"
|
||||
exit 1
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue