Skip to content

Instantly share code, notes, and snippets.

@maxsz
Created December 11, 2025 07:48
Show Gist options
  • Select an option

  • Save maxsz/f8448017d8c43277b6b2fa1293550343 to your computer and use it in GitHub Desktop.

Select an option

Save maxsz/f8448017d8c43277b6b2fa1293550343 to your computer and use it in GitHub Desktop.
Helix adaptive theme switcher
#!/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