bin: Cache default color scheme
This commit is contained in:
parent
e5192cdecd
commit
6c4aa5b99e
3 changed files with 14 additions and 2 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -3,3 +3,4 @@
|
||||||
*.swp
|
*.swp
|
||||||
|
|
||||||
.profiles
|
.profiles
|
||||||
|
.color-scheme
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,32 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
# "Automate" flipping applications between light and dark themes.
|
# "Automate" flipping applications between light and dark themes.
|
||||||
|
|
||||||
DOTFILES="$(cd "$(dirname "$(dirname "$(realpath "${BASH_SOURCE[0]}")")")" && pwd)"
|
DOTFILES="$(cd "$(dirname "$(dirname "$(realpath "${BASH_SOURCE[0]}")")")" && pwd)"
|
||||||
|
SCHEME_FILE="${DOTFILES}/.color-scheme"
|
||||||
|
|
||||||
scheme="${1:-dark}"
|
if [ -f "${SCHEME_FILE}" ]; then
|
||||||
|
default_scheme="$(head -n 1 "${SCHEME_FILE}")"
|
||||||
|
else
|
||||||
|
default_scheme='dark'
|
||||||
|
fi
|
||||||
|
|
||||||
|
scheme="${1:-${default_scheme}}"
|
||||||
|
|
||||||
if [ "${scheme}" = 'dark' ]; then
|
if [ "${scheme}" = 'dark' ]; then
|
||||||
ln -sf "${DOTFILES}/alacritty/colors-dark.yml" "${DOTFILES}/alacritty/colors.yml"
|
ln -sf "${DOTFILES}/alacritty/colors-dark.yml" "${DOTFILES}/alacritty/colors.yml"
|
||||||
ln -sf "${DOTFILES}/vim/colors/jdkaplan-dark.vim" "${DOTFILES}/vim/colors/jdkaplan.vim"
|
ln -sf "${DOTFILES}/vim/colors/jdkaplan-dark.vim" "${DOTFILES}/vim/colors/jdkaplan.vim"
|
||||||
ln -sf "${DOTFILES}/task/jdkaplan-dark.theme" "${DOTFILES}/task/color.theme"
|
ln -sf "${DOTFILES}/task/jdkaplan-dark.theme" "${DOTFILES}/task/color.theme"
|
||||||
"${DOTFILES}/alacritty/install"
|
"${DOTFILES}/alacritty/install"
|
||||||
|
echo "$scheme" > "${SCHEME_FILE}"
|
||||||
elif [ "${scheme}" = 'light' ]; then
|
elif [ "${scheme}" = 'light' ]; then
|
||||||
ln -sf "${DOTFILES}/alacritty/colors-light.yml" "${DOTFILES}/alacritty/colors.yml"
|
ln -sf "${DOTFILES}/alacritty/colors-light.yml" "${DOTFILES}/alacritty/colors.yml"
|
||||||
ln -sf "${DOTFILES}/vim/colors/jdkaplan-light.vim" "${DOTFILES}/vim/colors/jdkaplan.vim"
|
ln -sf "${DOTFILES}/vim/colors/jdkaplan-light.vim" "${DOTFILES}/vim/colors/jdkaplan.vim"
|
||||||
ln -sf "${DOTFILES}/task/jdkaplan-light.theme" "${DOTFILES}/task/color.theme"
|
ln -sf "${DOTFILES}/task/jdkaplan-light.theme" "${DOTFILES}/task/color.theme"
|
||||||
"${DOTFILES}/alacritty/install"
|
"${DOTFILES}/alacritty/install"
|
||||||
|
echo "$scheme" > "${SCHEME_FILE}"
|
||||||
else
|
else
|
||||||
echo "Unknown color scheme: ${scheme}"
|
echo "Unknown color scheme: ${scheme}"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
- mkdir -p ~/.config
|
- mkdir -p ~/.config
|
||||||
- mkdir -p ~/.config/direnv
|
- mkdir -p ~/.config/direnv
|
||||||
- mkdir -p ~/.task
|
- mkdir -p ~/.task
|
||||||
- ./bin/set-colors dark
|
- ./bin/set-colors
|
||||||
|
|
||||||
- clean: ['~', '~/.config']
|
- clean: ['~', '~/.config']
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue