Sync Omarchy themes to Claude Code (#6480)

* Sync Omarchy themes to Claude Code

Claude Code 2.1.118 added custom themes as JSON files in
~/.claude/themes, watched and hot-reloaded, so this follows the same
shape as the Pi integration (da53c0ff, bin/omarchy-theme-set-pi).

A claude.json template renders from each theme's colors.toml — no
per-theme files, so every stock and community theme is covered — and
omarchy-theme-set-claude copies the result into
~/.claude/themes/omarchy.json on theme switch, retinting running
sessions without a restart.

The theme just appears as "Omarchy" in the /theme picker, and picking
it once (or running omarchy-theme-set-claude --activate) makes every
future theme switch carry Claude Code along. No ~/.claude directory,
no-op.

* Respect custom Claude config directory

---------

Co-authored-by: David Heinemeier Hansson <david@hey.com>
This commit is contained in:
Abdul Moiz Shahzad
2026-08-01 13:06:19 -05:00
committed by GitHub
co-authored by David Heinemeier Hansson
parent 3cb3861fbc
commit 19144983e5
4 changed files with 134 additions and 0 deletions
+1
View File
@@ -197,6 +197,7 @@ post_theme_commands=(
omarchy-theme-set-tmux
omarchy-theme-set-gnome
omarchy-theme-set-pi
omarchy-theme-set-claude
omarchy-theme-set-browser
omarchy-theme-set-vscode
omarchy-theme-set-obsidian
+74
View File
@@ -0,0 +1,74 @@
#!/bin/bash
# omarchy:summary=Sync the generated Omarchy theme to Claude Code
# omarchy:args=[--activate]
# omarchy:hidden=true
set -euo pipefail
CLAUDE_SOURCE_PATH="$HOME/.local/state/omarchy/current/theme/claude.json"
CLAUDE_CONFIG_DIR="${CLAUDE_CONFIG_DIR:-$HOME/.claude}"
CLAUDE_THEME_PATH="$CLAUDE_CONFIG_DIR/themes/omarchy.json"
CLAUDE_SETTINGS_PATH="$CLAUDE_CONFIG_DIR/settings.json"
CLAUDE_ACTIVATE=0
usage() {
echo "Usage: omarchy-theme-set-claude [--activate]"
}
for arg in "$@"; do
case "$arg" in
--activate)
CLAUDE_ACTIVATE=1
;;
-h | --help)
usage
exit 0
;;
*)
usage >&2
exit 1
;;
esac
done
if [[ ! -f $CLAUDE_SOURCE_PATH ]]; then
if (( CLAUDE_ACTIVATE == 1 )); then
echo "Claude Code theme source missing: $CLAUDE_SOURCE_PATH" >&2
echo "Run omarchy-theme-refresh after selecting an Omarchy theme." >&2
exit 1
fi
exit 0
fi
if (( CLAUDE_ACTIVATE == 0 )) && [[ ! -d $CLAUDE_CONFIG_DIR ]]; then
exit 0
fi
write_setting_theme() {
local tmp
if [[ -f $CLAUDE_SETTINGS_PATH ]]; then
tmp=$(mktemp "$CLAUDE_SETTINGS_PATH.XXXXXX")
jq '.theme = "custom:omarchy"' "$CLAUDE_SETTINGS_PATH" >"$tmp"
mv "$tmp" "$CLAUDE_SETTINGS_PATH"
else
cat >"$CLAUDE_SETTINGS_PATH" <<EOF
{
"theme": "custom:omarchy"
}
EOF
fi
}
# Claude Code watches ~/.claude/themes and hot-reloads the file on change,
# so running sessions retint without a restart.
mkdir -p "$(dirname "$CLAUDE_THEME_PATH")"
tmp=$(mktemp "$CLAUDE_THEME_PATH.XXXXXX")
cp "$CLAUDE_SOURCE_PATH" "$tmp"
mv "$tmp" "$CLAUDE_THEME_PATH"
if (( CLAUDE_ACTIVATE == 1 )); then
write_setting_theme
fi
+43
View File
@@ -0,0 +1,43 @@
{
"name": "Omarchy",
"base": "{{ theme_type }}",
"overrides": {
"claude": "{{ accent }}",
"claudeShimmer": "{{ mix accent foreground 35% }}",
"text": "{{ foreground }}",
"inverseText": "{{ background }}",
"inactive": "{{ mix foreground background 40% }}",
"inactiveShimmer": "{{ mix foreground background 25% }}",
"subtle": "{{ muted }}",
"suggestion": "{{ cyan }}",
"permission": "{{ blue }}",
"permissionShimmer": "{{ mix blue foreground 35% }}",
"remember": "{{ yellow }}",
"success": "{{ green }}",
"error": "{{ red }}",
"warning": "{{ yellow }}",
"warningShimmer": "{{ mix yellow foreground 35% }}",
"merged": "{{ magenta }}",
"promptBorder": "{{ accent }}",
"promptBorderShimmer": "{{ mix accent foreground 35% }}",
"planMode": "{{ cyan }}",
"autoAccept": "{{ yellow }}",
"bashBorder": "{{ bright_yellow }}",
"ide": "{{ bright_cyan }}",
"diffAdded": "{{ mix background green 15% }}",
"diffRemoved": "{{ mix background red 15% }}",
"diffAddedDimmed": "{{ mix background green 8% }}",
"diffRemovedDimmed": "{{ mix background red 8% }}",
"diffAddedWord": "{{ mix background green 32% }}",
"diffRemovedWord": "{{ mix background red 32% }}",
"userMessageBackground": "{{ mix background foreground 6% }}",
"userMessageBackgroundHover": "{{ mix background foreground 10% }}",
"bashMessageBackgroundColor": "{{ mix background foreground 6% }}",
"memoryBackgroundColor": "{{ mix background foreground 6% }}",
"selectionBg": "{{ selection_background }}",
"rate_limit_fill": "{{ accent }}",
"rate_limit_empty": "{{ mix background foreground 20% }}",
"briefLabelYou": "{{ yellow }}",
"briefLabelClaude": "{{ accent }}"
}
}
+16
View File
@@ -365,6 +365,22 @@ HOME="$PI_TMPDIR" "$ROOT/bin/omarchy-theme-set-pi" --activate
jq -e '.theme == "omarchy-system" and .model == "keep-me"' "$PI_TMPDIR/.pi/agent/settings.json" >/dev/null
pass "pi theme activation preserves existing settings"
jq -e '.name == "Omarchy" and .base == "light" and .overrides.text == "#ffffff"' "$NEXT_THEME/claude.json" >/dev/null
pass "claude theme template is generated from standard themed templates"
cp "$NEXT_THEME/claude.json" "$CURRENT_THEME/claude.json"
CLAUDE_TEST_CONFIG="$PI_TMPDIR/.claude-work"
mkdir -p "$CLAUDE_TEST_CONFIG"
HOME="$PI_TMPDIR" CLAUDE_CONFIG_DIR="$CLAUDE_TEST_CONFIG" "$ROOT/bin/omarchy-theme-set-claude"
[[ -f $CLAUDE_TEST_CONFIG/themes/omarchy.json ]] || fail "claude theme is synced to the configured directory"
[[ ! -d $PI_TMPDIR/.claude ]] || fail "claude theme sync avoids the default directory when configured"
pass "claude theme sync respects CLAUDE_CONFIG_DIR"
echo '{"model":"keep-me"}' >"$CLAUDE_TEST_CONFIG/settings.json"
HOME="$PI_TMPDIR" CLAUDE_CONFIG_DIR="$CLAUDE_TEST_CONFIG" "$ROOT/bin/omarchy-theme-set-claude" --activate
jq -e '.theme == "custom:omarchy" and .model == "keep-me"' "$CLAUDE_TEST_CONFIG/settings.json" >/dev/null
pass "claude theme activation preserves configured settings"
THEME_TMPDIR=$(mktemp -d)
OMARCHY_PATH="$ROOT" HOME="$THEME_TMPDIR" OMARCHY_THEME_HEADLESS=1 "$ROOT/bin/omarchy-theme-set" "Tokyo Night"
background_path=$(readlink -f "$THEME_TMPDIR/.local/state/omarchy/current/background" 2>/dev/null || true)