Themes: Fix washed-out diff accents and invisible word highlighting - #825
Themes: Fix washed-out diff accents and invisible word highlighting#825masonmcelvain wants to merge 4 commits into
Conversation
Low-contrast diff accents were rescued with a fixed 45% black/white blend, washing genuine palette colors into pastel or mud — e.g. catppuccin-latte's green (contrast 2.96, missing the floor by 0.04) was crushed from #40a02b to #235818 even though a 2% nudge suffices. Since sign colors seed the derived row tints and badges, the wash propagated through the whole theme. Step the blend up from 2% until the contrast floor passes instead, which preserves hue by construction and keeps saturation loss proportional to how far out of range the accent is. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contrast stepping in readableTintedBackground could converge a theme's row tint (0.12/0.2) and word-emphasis tint (0.18/0.28) onto the same color, making word-level diff highlighting invisible — everforest-light, one-dark-pro, and material-theme-palenight all collapsed to identical pairs, and plastic sat 6 channel units apart. Derive the emphasis tints first at full readable strength, then step the row tint further down until the pair clears a minimum channel-distance floor. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
@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. |
|
Pulled this onto fresh main and dug through it. The incremental sign-color rescue looks right, but I don’t think the PR is ready yet (feel free to push back on any of this). The word-emphasis part seems to solve the same problem twice. The new sign-color tests also don’t catch the old washout behavior. I replayed the old 45% blend against all 36 rescued catalog accents, and every one still passes the new contrast and hue assertions—blending toward black or white mostly preserves hue. A test for the first passing step, or at least a bound on how far the result can move from the source, would cover the regression better. One smaller edge case: the rescue chooses white whenever background luminance is at most 0.45, but white can’t reach 3:1 once the background is above 0.30. For example, I’d keep the incremental sign rescue, tighten its tests, and fold the emphasis fix into the existing renderer guard. This comment was generated by Pi using GPT-5.6 Sol |
The theme layer and the renderer's word-diff guard each enforced their own separation floor (12 vs 28), so the renderer rewrote 77 of 130 bundled row/content pairs after the theme had already separated them, eroding the text-readability guarantee in the process. Derive bundled themes to the renderer's 28-distance floor via one shared MIN_EMPHASIS_SEPARATION constant, leaving the renderer guard as a no-op backstop for custom themes and transparent surfaces. Tests now assert the final rendered emphasis color, require rescued sign colors to be the smallest passing blend (the old 45% wash fails this for all 36 rescued accents), and cover the mid-luminance anchor gap where white could not reach the promised 3:1 floor. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Thanks for the review! I agree with all three points. I updated the PR comment "Feature" screenshots. The following response was written by Claude Fable 5: One place I'd push back slightly: folding the emphasis fix into the renderer guard goes in the wrong direction. The test now asserts the final rendered highlight — For the sign-color tests, I added the minimality assertion you suggested: each rescued accent must equal the first 2% blend step (from either anchor) that clears the floor. Replaying the old 45% wash against that fails for all 36 rescued accents. And |
The two contrast guards in
src/ui/themes.tsprotected readability but destroyed theme identity in the process. This fixes both while keeping every existing contrast invariant.Changes
readableDiffSignnow rescues low-contrast accents with the smallest black/white blend that clears the 3:1 floor, stepping up from 2%, instead of a fixed 45% wash.#40a02b→#3f9d2a) instead of being crushed to#235818.addedContentBg/removedContentBg) now derive first at full readable strength, and the row tints step further down until the pair clears a 12 channel-distance separation floor (readableSeparatedRowBackground).Tests
QA
--theme catppuccin-latte(sign colors),--theme one-dark-proor--theme everforest-light(word-level highlighting on changed rows).catpuccin-latte(light rescue)gruvbox-dark-hard(dark rescue)snazzy-light(light rescue)one-dark-pro(tint)poimandres(tint)everforest-light(rescue and tint)