Repository navigation
Themes: Harvest bundled diff accents from real VS Code tokens - #828
Conversation
|
@masonmcelvain is attempting to deploy a commit to the Modem Team on Vercel. A member of the Team first needs to authorize it. |
|
PR author is not in the allowed authors list. |
|
@masonmcelvain Thank you for submitting 🙏 Okay this is good to go but I want to merge #825 first, I have some questions there to address. |
Replace the hand-collected BUNDLED_SHIKI_THEME_DIFF_COLORS table with one generated by a script Mechanics: per-slot token priority (editorGutter -> diffEditor -> terminal.ansi -> gitDecoration), alpha stripped instead of composited, and hue/saturation/contrast validation with fall-through to the next source or the generic fallback palette. The old table stored mis-sourced VS Code tokens for ~25 themes: gitDecoration file-label colors, alpha tokens flattened onto the editor background at harvest time, and unrelated tokens (slack's white "removed", min-light's badge-grey "modified"). buildShikiTheme then composited those pre-blended values onto the background again, producing washed-out or wrong-hue diff rows, signs, and badges. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Lock the generated table two ways: policy unit tests plus a drift test that re-harvests the installed @shikijs/themes and compares it to the checked-in table, and independent table-driven checks in catalog.test.ts (6-digit hex, red-family removed, green/teal-family added, no greys) that deliberately re-derive hue locally so a harvester bug cannot certify its own output. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Declare @shikijs/themes as an exact-version devDependency matching the shiki version @pierre/diffs resolves, so the harvest and the runtime highlighter see the same theme data and future bumps are a deliberate, visible diff line. A conformance test fails if the pin and Pierre's resolved shiki drift apart. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The harvested everforest-light removed accent rescues to a pale red whose readable tint band is narrow. At 0.02 steps the word-emphasis tint rounds down to 0.12 even though a 0.13 blend is still readable, and accumulated float drift skips the final 0.02 row step, so the pair collapses and the renderer guard rewrites it at the cost of the 4.5:1 text guarantee. Search tint amounts at 0.01 granularity with integral step counts so the emphasis tint stops at its full readable strength and the row search never skips its last step.
811f977 to
1e21550
Compare
|
Rebased onto main (post-#825) and force-pushed — the branch conflicted in One real interaction surfaced beyond textual conflicts: the harvested everforest-light Also updated the github-dark-default |
Replaces the hand-collected theme diff colors with auto-generated ones and a script to regenerate them on demand. Also pins the
@shikijs/themespackage as a devDependency.Changes
scripts/generate-theme-diff-colors.ts(bun run generate:theme-colors), which rewrites the table insrc/core/theme/catalog.tsbetween generated markers.@shikijs/themesas an exact devDependency at 3.23.0 (the version@pierre/diffs' shiki resolves inbun.lock) so the harvest and the runtime highlighter read the same theme JSONs.Tests
@shikijs/themesand compares it to the checked-in table.src/core/theme/catalog.test.tsadds independent table-driven checks (6-digit hex, red-family removed, green/teal-family added, no greys) with locally re-derived hue math.themes.test.tsexpectations that asserted the old GitHub added accents (#3fb950→#2ea043,#1a7f37→#116329).QA
Smoke-check visually:
--theme rose-pine(deleted rows red, not purple),--theme gruvbox-dark-medium(added rows green, not beige),--theme tokyo-night,--theme slack-dark(generic fallback accents).rose-pineeverforest-darkeverforest-lightgruvbox-dark-mediumtokyo-nightslack-darkslack-ochin