dotfiles/bin/alacritty-toggle.sh

17 lines
550 B
Bash
Executable file

#!/usr/bin/env bash
#
# Adjusts Alacritty color scheme to match macOS dark/light mode setting
# FIXME: make this work for Linux/Arch too
mode=$(defaults read -g AppleInterfaceStyle 2>/dev/null || echo "Light")
alacritty_config=~/.config/alacritty/alacritty.toml
theme_dark="kanso-ink"
theme_light="kanso-pearl"
if [ "$mode" = "Dark" ]; then
# Switch to dark theme
sed -i '' "s#$theme_light.toml#$theme_dark.toml#" $alacritty_config
else
# Switch to light theme
sed -i '' "s#$theme_dark.toml#$theme_light.toml#" $alacritty_config
fi