Skip to content

feat(themes): apply color themes in regular (non-powerline) mode (fg-only) - #12

Merged
axisrow merged 1 commit into
mainfrom
feat/regular-mode-themes
Sep 26, 2026
Merged

axisrow merged 1 commit into
mainfrom
feat/regular-mode-themes

Conversation

@axisrow

@axisrow axisrow commented Sep 26, 2026

Copy link
Copy Markdown
Owner

What

Makes the built-in theme catalog usable in regular (non-powerline) mode: a new top-level theme setting cycles the chosen theme's segment palette across widgets as foreground colors. Feature half of sirmalloc#604 (the U+E0B0 separator fallback is deliberately left for a separate change).

Semantics

  • theme: "dracula" (any POWERLINE_THEMES name) cycles theme[level].bg[] as widget foregrounds — bg[] is the vivid segment palette, while fg[] holds the dark text colors meant to sit on those segments. ansi16-level bg* names are converted through the existing bgToFg() helper.
  • Explicit per-widget colors win over the theme; the theme beats widget default colors. Explicit colors keep their palette slot, so adding one accent doesn't shift the rhythm of the surrounding widgets.
  • Separators and flex separators are not themed and consume no slot (powerline filters them out before indexing — same rule).
  • Merged widgets share one slot; preserves-colors widgets keep their intrinsic ANSI output and still advance the slot — both mirror the powerline renderer.
  • Unset / 'custom' / unknown name → no theming. The level follows colorLevel, using the 16/256/truecolor calibrations already shipped with each theme.
  • Additive optional schema key: old configs parse unchanged, no version bump. ccstatusline set theme <name> / get work through the existing generic allowlist — zero CLI code changes. A TUI picker is left to the maintainer; this PR is config+CLI only.

Verification

  • bun test: 2450 pass / 0 fail. New renderer-regular-theme.test.ts covers cycle order, explicit-wins + slot rhythm, separators unthemed, preserves-colors, merged widgets sharing a slot, unset/'custom'/unknown names, level 1/2/3 (including the bgToFg conversion for ansi16 palettes), and schema round-trip.
  • bun run lint clean; bun run build OK.
  • Render check through the built binary with a theme: "dracula", colorLevel: 3 config: uncolored widgets emit exact truecolor codes (38;2;189;147;249, 38;2;248;248;242, …), separators stay unthemed.
  • CLI round-trip: set theme nord → get --json reports "theme":"nord".
  • Live run as the active Claude Code status line (theme set, per-widget colors temporarily removed): all widgets picked up the cycled Dracula palette in the real render path; config restored afterwards.

🤖 Generated with Claude Code

…only

Add a top-level `theme` setting that cycles a POWERLINE_THEMES segment
palette across widgets as foreground colors when powerline is disabled.
The theme's bg[] array is the vivid palette (fg[] holds the dark
text-on-segment colors); ansi16-level bg* names are converted with the
existing bgToFg() helper.

Semantics: explicit per-widget colors win over the theme, theme beats
widget defaults; explicit colors keep their palette slot so the rhythm
of the surrounding widgets is stable. Separators and flex separators
are neither themed nor consume slots; merged widgets share one slot;
preserves-colors widgets keep their intrinsic ANSI output and still
advance the slot - both mirroring the powerline renderer. Unset,
'custom', or unknown names disable theming. Additive optional schema
key - configs written before it parse unchanged (no version bump);
`ccstatusline set theme <name>` works through the existing generic
`set` allowlist with zero CLI changes.

Closes the feature half of sirmalloc#604.

Co-Authored-By: Claude Code <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant