Created
December 11, 2025 07:48
-
-
Save maxsz/f8448017d8c43277b6b2fa1293550343 to your computer and use it in GitHub Desktop.
Helix adaptive theme switcher
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| set -e -u -o pipefail | |
| THEME_LIGHT="ayu_light" | |
| THEME_DARK="ayu_dark" | |
| THEME_FILEPATH="${HOME}/.config/helix/themes/adaptive.toml" | |
| if [[ $DARKMODE == 0 ]]; then | |
| sed -i '' -E "s/^inherits = \"$THEME_DARK\"$/inherits = \"$THEME_LIGHT\"/" "$THEME_FILEPATH" | |
| elif [[ $DARKMODE == 1 ]]; then | |
| sed -i '' -E "s/^inherits = \"$THEME_LIGHT\"$/inherits = \"$THEME_DARK\"/" "$THEME_FILEPATH" | |
| else | |
| echo "Error: Invalid theme '$DARKMODE'. Expected '0' or '1'." >&2 | |
| exit 1 | |
| fi | |
| pkill -USR1 hx || true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment