Skip to content

feat(cli): named theme palettes, theme set persisted in config - #500

Merged
bmscomp merged 1 commit into
mainfrom
feat/cli-theme-palettes
Oct 25, 2026
Merged

bmscomp merged 1 commit into
mainfrom
feat/cli-theme-palettes

Conversation

@bmscomp

@bmscomp bmscomp commented Oct 25, 2026 •

Copy link
Copy Markdown
Owner

What

  • pkg/theme gets named palettes (palettes.go), each a complete token set with a light and a dark shade per role. tokens.go reads its colours from the palette chosen at start-up, so every CLI style follows it; the choice is fixed for the life of the process.
  • Selection: KATES_THEME, else theme: in ~/.kates.yaml, else default. An unknown name falls back to default.
  • Palettes:
    • default: the Kates look, values unchanged.
    • aurora: new, teal/violet, tuned for light and dark terminals.
    • dracula, gruvbox, monokai, solarized: their colours on dark terminals; light terminals keep the default shades, where those schemes are unreadable.
  • kates theme set <name> writes theme: to ~/.kates.yaml (new Config.Theme field, omitempty) without touching contexts. Setting default removes the key; a KATES_THEME that overrides it is pointed out.
  • kates theme list marks the active theme and warns when the requested one is not built in; preview shows every role and sample output.
  • Shell completion for theme preview and theme set comes from theme.Names().

Why

kates theme only previewed palettes: nothing read a theme setting, so every command rendered the default colours whatever was picked.

Reviewer notes

  • Users who never pick a theme see exactly the old colours; palettes_test.go pins that.
  • A malformed ~/.kates.yaml is ignored by the theme lookup (the CLI's own config loading still reports it).
  • Locally: go build ./..., go vet, go test ./pkg/theme/ ./cmd/ pass; golangci-lint run --new-from-rev=HEAD reports 0 new issues.

`kates theme` only previewed palettes: nothing read a theme setting, so
every command rendered the default colors whatever was picked.

pkg/theme now holds the palettes as complete token sets (every role with
a light and a dark shade) and picks one at start-up: KATES_THEME, else
`theme:` in ~/.kates.yaml, else "default". The package tokens come from
that palette, so all CLI styles follow it; the choice is fixed for the
life of the process.

- default keeps the exact Kates values, pinned by a test.
- aurora is new, tuned for light and dark terminals.
- dracula, gruvbox, monokai and solarized use their dark colors on dark
  terminals and keep the default shades on light ones, where they are
  unreadable.
- `kates theme set <name>` saves the theme in ~/.kates.yaml without
  touching contexts; setting default removes the key, and a KATES_THEME
  override is pointed out.
- `kates theme list` marks the active theme and warns when the requested
  one is not built in; `preview` shows every role and sample output.
- Completion for preview and set comes from theme.Names().
@bmscomp
bmscomp force-pushed the feat/cli-theme-palettes branch from 5536499 to dff63a9 Compare October 25, 2026 21:24
@bmscomp
bmscomp merged commit 759f18d into main Oct 25, 2026
56 checks passed
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