Seamless light/dark mode synchronization across your entire development environment
The theme system automatically synchronizes your development environment with macOS appearance settings. When you switch between light and dark mode, all tools update instantly:
The system uses a LaunchAgent that monitors macOS appearance changes:
# Check current macOS appearance
defaults read -g AppleInterfaceStyle 2>/dev/null || echo "Light"
| macOS Mode | Terminal Theme | Neovim Theme |
|---|---|---|
| Light | tokyonight_day |
tokyonight-day |
| Dark | tokyonight_night |
tokyonight-night |
When switching themes, the system atomically updates:
~/.config/alacritty/theme.toml - Alacritty colors~/.config/tmux/theme.conf - tmux status bar styling~/.config/starship.toml - Starship prompt colors# Auto-detect and apply system theme
theme
# Force specific theme
theme light
theme dark
# Use custom theme variant
theme tokyonight_storm
theme tokyonight_moon
Light Variants:
tokyonight_day - Bright, high contrastDark Variants:
tokyonight_night - Deep blue darknesstokyonight_storm - Softer dark variant (default)tokyonight_moon - Purple-tinted darkness" Check current theme
:colorscheme
" Manual theme switching (overrides auto-sync)
:colorscheme tokyonight-day
:colorscheme tokyonight-night
:colorscheme tokyonight-storm
:colorscheme tokyonight-moon
Set your preferred themes in shell configuration:
# In ~/.dotfiles.private/exports.zsh
export THEME_LIGHT="tokyonight_day"
export THEME_DARK="tokyonight_storm" # Custom dark variant
# Check interval (how often to check macOS appearance)
export THEME_CHECK_INTERVAL=3 # seconds
# Debounce period (prevent rapid switching)
export THEME_DEBOUNCE=5 # seconds
Create your own theme variants:
# 1. Create theme directory
mkdir ~/.dotfiles/src/theme/my_custom_theme
# 2. Add theme variant files following existing theme structure
# 3. Regenerate configs
~/.dotfiles/src/theme/regenerate-all.sh
# 4. Use your theme
theme my_custom_theme
# Check theme scripts exist
ls ~/.dotfiles/src/theme/*.sh
# Validate theme configurations
~/.dotfiles/src/theme/validate-themes.sh
# Run theme switcher directly
~/.dotfiles/src/theme/switch-theme.sh
# Or use the theme alias
theme # Auto-detect from macOS
theme day # Light theme
theme night # Dark theme
Run manually to check for errors:
~/.dotfiles/src/theme/switch-theme.sh auto 2>&1
Check lockfile (if switching seems stuck):
ls -la /tmp/theme-switch.lock
Force theme update:
~/.dotfiles/src/theme/switch-theme.sh auto
Reset to system default:
rm ~/.config/theme/current-theme
theme
Restart applications:
# Reload tmux config
tmux source-file ~/.tmux.conf
# Restart Alacritty
# Close and reopen terminal
# Reload Neovim theme
# In Neovim: :source ~/.config/nvim/init.lua
View detailed logs:
# Manual switching logs
~/.dotfiles/src/theme/switch-theme.sh auto 2>&1
Reset all state:
rm -rf ~/.cache/theme
rm -rf ~/.config/theme
theme # Reinitialize
Add support for new applications:
src/theme/[theme-name]/ and src/theme/templates/switch-theme.sh to copy your filesExample for adding VSCode theme:
# In src/theme/tokyonight_night/vscode.json
{
"workbench.colorTheme": "Tokyo Night"
}
# In switch-theme.sh, add:
if [[ -f "$theme_dir/vscode.json" ]]; then
cp "$theme_dir/vscode.json" "$HOME/.config/Code/User/settings.json"
fi
Override themes for work environments:
# In ~/.dotfiles.private/work/theme.zsh
if [[ "$PWD" == *"/work/"* ]]; then
export THEME_LIGHT="tokyonight_day"
export THEME_DARK="tokyonight_storm"
fi
Time-based theme switching:
# In ~/.dotfiles.private/functions.zsh
work_theme() {
local hour=$(date +%H)
if [[ $hour -lt 9 || $hour -gt 18 ]]; then
theme dark
else
theme light
fi
}
src/theme/
├── switch-theme.sh # Main theme switching logic
├── generate-theme.sh # Theme configuration generator
├── validate-themes.sh # Theme validation utility
├── regenerate-all.sh # Regenerate all theme configs
├── templates/ # Theme templates (Alacritty, etc.)
├── tokyonight/ # TokyoNight theme variants
├── catppuccin/ # Catppuccin theme variants
├── dracula/ # Dracula theme
├── nord/ # Nord theme
└── [other-themes]/ # Additional theme directories
Pro Tip: The theme system works best when you let it handle everything automatically. Set your preferred light/dark themes once and enjoy seamless switching as you work throughout the day!