Skip to content

[feat] tui: monokai wears Monokai Pro's palette - #176

Merged
gogoout merged 2 commits into
fix/157-stock-palettesfrom
feat/monokai-pro
Sep 26, 2026
Merged

gogoout merged 2 commits into
fix/157-stock-palettesfrom
feat/monokai-pro

Conversation

@gogoout

@gogoout gogoout commented Sep 26, 2026

Copy link
Copy Markdown
Member

Stacked on #175. Retarget this PR to main before merging it, after #175 is merged. A squash merge into the fix branch would strand it there.

Why

After #175, classic Monokai sits on its stock olive ground #272822. Every grey mixed from that ground takes the olive too, and the yellow-green addition tint is close to its hue. So a screen of additions reads as green. The monokai theme now wears Monokai Pro's warm-grey palette instead.

What changes

  • monokai is Monokai Pro. The config name stays the same, so existing theme = "monokai" configs keep working. Classic Monokai is no longer shipped. A reader on monokai will see a different palette after upgrading.
  • A seed can bundle its syntax theme. Seed::syntax is now a Syntax: Embedded (a two-face name, as before) or Bundled (a .tmTheme compiled in with include_bytes! and parsed by syntect's ThemeSet::load_from_reader). Nothing is loaded at run time. two-face does not ship Monokai Pro, which is why this is needed (ADR 0040).
  • monokai.tmTheme is written for this crate. It uses Monokai Pro's published palette values only. No official or ported theme file is copied, and the docs say the crate is not affiliated with Monokai Pro. The scope mapping is our own.
  • Seed values:
    • The blue is lifted from #78DCE8 to #6CD9E8, which clears the chroma floor, as Dracula's cyan was lifted.
    • The orange #FC9867 is the search fill, so the fill and the yellow skim tier are two different colours.
    • The theme's own line numbers #939293 are used.
    • The comment colour #727072 is under 3:1 on the ground, so the noise tier uses the mix.

Tests

  • cargo test, clippy -D warnings and fmt are clean.
  • every_named_theme_builds parses the bundled file, and the legibility, chroma, distinctness and own-colour tests all run over it.
  • The .tmTheme is included in the cargo package file list.
  • assets/themes/monokai.png is regenerated.

@gogoout

gogoout commented Sep 26, 2026

Copy link
Copy Markdown
Member Author

@claude review

@claude

claude Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Claude finished @gogoout's task in 2m 22s —— View job


Review complete

  • Gather context (diff, ADR 0040, spec/tui.md, CLAUDE.md rules)
  • Review crates/tui/src/theme/mod.rs (Syntax enum, bundled loading)
  • Review crates/tui/src/theme/monokai.rs and monokai.tmTheme
  • Review the other theme file diffs (blue/comment/line-number tweaks)
  • Check ADR 0040 against design/constraints rules
  • Check tests, docs, spec updates for consistency
  • Post review feedback

This is a clean, well-scoped change. Summary of what I checked:

Design (ADR 0040 / Syntax enum, crates/tui/src/theme/mod.rs:190-210)

  • Syntax::Embedded/Bundled is exactly the "concrete second case, not a plug-in point" the ADR argues for — no dyn, no new trait, satisfies design rule 2. Business logic still owns the enum; two_face/syntect stay adapters it calls into, so rule 4 isn't touched.
  • .expect("a bundled .tmTheme parses") on a compiled-in asset is the right call — it can only fail as a build-time bug, and every_named_theme_builds is the test that would catch it. Matches the ADR's own reasoning.
  • Nothing is read from disk/network at runtime, so [review].theme staying a name (ADR 0024) is preserved.

monokai.tmTheme

  • Header comment states the palette source and non-affiliation, no copied lines from an official/ported theme, scope→colour mapping looks like an original piece of work. Consistent with the "no line copied" constraint in the ADR.
  • Scope colours line up with the seed's add/del/skim/highlight/finding values (e.g. Inserted → #A9DC76 matches add, Deleted → #FF6188 matches del), so the chrome and the code read as one palette, which is the whole point of ADR 0024/0039.

monokai.rs seed

  • Values match the palette documented in the .tmTheme header and the PR body's stated rationale (blue lift for the chroma floor, orange for the search fill since yellow is taken by skim, comment under 3:1 so noise takes the mixed grey). No inconsistency found between the doc comment, the ADR, and the actual constants.

Mechanical changes

  • The other nine theme files (dark.rs, dracula.rs, gruvbox_dark.rs, one_dark.rs, etc.) are a pure EmbeddedThemeName → Syntax::Embedded(...) wrap, no behaviour change.
  • every_named_theme_builds and the legibility/chroma/distinctness/own-colour tests are unmodified — they already loop over ALL themes, so they pick up the bundled Monokai for free without new test code, matching the PR's claim.
  • Docs (AGENTS.md, spec/tui.md, docs/cli.md, crates/tui/README.md) and the ADR count in AGENTS.md (0001–0040) are all updated consistently.

Minor, non-blocking observation

  • Syntax::Bundled::theme() re-parses the .tmTheme from bytes on every call to Theme::named (crates/tui/src/theme/mod.rs:200), rather than caching the parsed Theme. Looking at the call sites, this only runs at startup and on an explicit theme change (crates/tui/src/app/config.rs:445), never per-frame, and it's no worse than the pre-existing two_face::theme::extra()[..].clone() path this replaces — so not worth blocking on, just flagging in case a future bundled theme is loaded somewhere hotter.

What I could not verify

  • I could not run cargo test, cargo clippy, cargo fmt --check, or the parity/privacy-sweep commands — the sandbox required approval for any cargo/shell command beyond simple reads, and none was available in this session. If you'd like me to actually run the verification suite, allow cargo test, cargo clippy --all-targets, and cargo fmt --check in --allowedTools for this repo.
  • I did not attempt to render the TUI to eyeball the new palette (this is exactly the case process.md flags as needing the author's own look before merge — the PR already says assets/themes/monokai.png was regenerated, which is the right artifact for that).
  • git grep for the removed MonokaiExtendedOrigin/MonokaiExtended names turned up only the two ADRs (0039, 0040) referencing it as history, no stale code references.

No blocking issues found. Nice fix for the "screen of additions reads as green" problem, and the ADR does the work of naming what it overturns (0039's MonokaiExtendedOrigin choice) rather than hiding it.

Reminder from the PR description: this is stacked on #175 and targets fix/157-stock-palettes — retarget to main after #175 merges, or a squash merge will strand it on the intermediate branch.

Classic Monokai, matched to its stock olive ground, reads as green: every
grey mixed from that ground takes the olive, and the yellow-green addition
tint sits right beside it. The `monokai` theme now wears Monokai Pro's
warm-grey palette instead, under the same name, so existing configs keep
working. Classic Monokai is no longer shipped.

two-face does not ship Monokai Pro, so a seed's syntax theme is now a
`Syntax`: a two-face name as before, or a `.tmTheme` compiled into the
crate and parsed by syntect. `monokai.tmTheme` is written here from Monokai
Pro's published palette values alone; no official or ported theme file is
copied, and the crate is not affiliated with Monokai Pro (ADR 0040). Its
blue is lifted to clear the chroma floor, as Dracula's cyan was, and its
orange is the search fill so the fill and the skim tier are two colours.
@gogoout

gogoout commented Sep 26, 2026

Copy link
Copy Markdown
Member Author

On the re-parse note: no change. Theme::named runs at startup and on an explicit theme change only, and the embedded path it replaces also clones a whole parsed theme on every call. Rebased onto #175's review fix (one borrow changed in the test).

Review follow-up. derive() takes the search fill from the seed, so the
file's findHighlight is inert, but it said yellow where the seed says
orange. They agree now.
@gogoout
gogoout added this pull request to stack #178 September 26, 2026 23:49
@gogoout
gogoout merged commit e2f4fe0 into fix/157-stock-palettes Sep 26, 2026
1 check 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