Original issue comment: alacritty/alacritty#5999 (comment)
Run the following command to clone themes:
mkdir -p ~/.config/alacritty/themes
git clone https://github.com/alacritty/alacritty-theme ~/.config/alacritty/themes
Add the following content to ~/.config/alacritty/alacritty.toml
:
import = ["~/.config/alacritty/active.toml"]
[env]
ALACRITTY = "true"
Add the following content to ~/.zshrc
:
if [ "$ALACRITTY" = "true" ]
then
theme() {
ln -sf $HOME/.config/alacritty/themes/themes/$1.toml $HOME/.config/alacritty/active.toml
}
local ALACRITTY_THEME=$(defaults read -g AppleInterfaceStyle 2>/dev/null || echo "Light")
if [ "$ALACRITTY_THEME" = "Dark" ]
then
theme "github_dark"
else
theme "github_light"
fi
fi
Alacritty will then change the theme every time it starts.
if [ "$ALACRITTY" = "true" ]
then
local ALA_HOME=$HOME/.config/alacritty
local ALA_THEME=$(defaults read -g AppleInterfaceStyle 2>/dev/null || echo "Light" | tr '[:upper:]' '[:lower:]')
ln -sf $ALA_HOME/themes/themes/github_$ALA_THEME.toml $ALA_HOME/active.toml
fi
if [ "$ALACRITTY" = "true" ]
then
local ALA_HOME=$HOME/.config/alacritty
local ALA_THEME=$(defaults read -g AppleInterfaceStyle 2>/dev/null || echo "Light" | tr '[:upper:]' '[:lower:]')
theme() { ln -sf $ALA_HOME/themes/themes/$1.toml $ALA_HOME/active.toml; }
theme github_$ALA_THEME
fi
In fish shell it needs to be slightly different:
Thanks for this.