#!/bin/bash # Check if macOS is in dark mode # Returns "Dark" if dark mode is on, nothing if light mode DARK_MODE=$(defaults read -g AppleInterfaceStyle 2>/dev/null) # Path to the active color config file COLOR_FILE="$HOME/.config/alacritty/color.toml" if [ "$DARK_MODE" = "Dark" ]; then # Copy dark theme cat > "$COLOR_FILE" << 'EOF' # Active theme: Solarized Dark [colors.primary] background = "#002b36" foreground = "#839496" [colors.normal] black = "#073642" red = "#dc322f" green = "#859900" yellow = "#b58900" blue = "#268bd2" magenta = "#d33682" cyan = "#2aa198" white = "#eee8d5" [colors.bright] black = "#002b36" red = "#cb4b16" green = "#586e75" yellow = "#657b83" blue = "#839496" magenta = "#6c71c4" cyan = "#93a1a1" white = "#fdf6e3" EOF echo "Switched to dark theme" # Update tmux theme for dark mode tmux set-option -g status-style "fg=colour15,bg=colour0" 2>/dev/null || true else # Copy light theme cat > "$COLOR_FILE" << 'EOF' # Active theme: Solarized Light [colors.primary] background = "#fdf6e3" foreground = "#657b83" [colors.normal] black = "#073642" red = "#dc322f" green = "#859900" yellow = "#b58900" blue = "#268bd2" magenta = "#d33682" cyan = "#2aa198" white = "#eee8d5" [colors.bright] black = "#002b36" red = "#cb4b16" green = "#586e75" yellow = "#657b83" blue = "#839496" magenta = "#6c71c4" cyan = "#93a1a1" white = "#fdf6e3" EOF echo "Switched to light theme" # Update tmux theme for light mode tmux set-option -g status-style "fg=colour0,bg=colour7" 2>/dev/null || true fi # Touch the main config to trigger reload touch "$HOME/.config/alacritty/alacritty.toml" # include this in your alacrity.toml: # [general] # import = [ # "~/.config/alacritty/color.toml" # ]