From 19144983e56915e7dd1d1e617c685f29fb89aa1a Mon Sep 17 00:00:00 2001 From: Abdul Moiz Shahzad <148609638+MoizIbnYousaf@users.noreply.github.com> Date: Sat, 1 Aug 2026 14:06:19 -0400 Subject: [PATCH] Sync Omarchy themes to Claude Code (#6480) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 --- bin/omarchy-theme-set | 1 + bin/omarchy-theme-set-claude | 74 ++++++++++++++++++++++++++++++++++ default/themed/claude.json.tpl | 43 ++++++++++++++++++++ test/cli | 16 ++++++++ 4 files changed, 134 insertions(+) create mode 100755 bin/omarchy-theme-set-claude create mode 100644 default/themed/claude.json.tpl diff --git a/bin/omarchy-theme-set b/bin/omarchy-theme-set index 8e0cb9e3..d987d97a 100755 --- a/bin/omarchy-theme-set +++ b/bin/omarchy-theme-set @@ -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 diff --git a/bin/omarchy-theme-set-claude b/bin/omarchy-theme-set-claude new file mode 100755 index 00000000..06c2799c --- /dev/null +++ b/bin/omarchy-theme-set-claude @@ -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" </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)