Skip to content

fix(ryoku-zed-theme): derive a real light variant when the palette renders dark - #237

Open
Matcraft94 wants to merge 2 commits into
Ryoku-dev:mainfrom
Matcraft94:fix/zed-theme-light-variant
Open

Matcraft94 wants to merge 2 commits into
Ryoku-dev:mainfrom
Matcraft94:fix/zed-theme-light-variant

Conversation

@Matcraft94

@Matcraft94 Matcraft94 commented Dec 5, 2026 •

Copy link
Copy Markdown

Problem

Ryoku Dynamic Light shipped with the same dark surfaces as Dark: Ryoku's palette plane renders a single dark scheme into both matugen template variants, so the light variant's background arrived at luminance ~0.01. A Zed user switching to light mode got a dark editor while the rest of the system went light.

Fix

theme.ts --sync now validates each variant's surface luminance against its declared appearance. When they disagree, the variant is rebuilt from the opposite one:

  • hue and chroma are preserved per color (OKLCH)
  • lightness is mirrored across the source theme's own background→text range, clamped to the displayable gamut
  • the existing improve() pass re-runs afterwards, so WCAG AA contrast (≥ 4.5:1) is re-enforced on the derived variant
  • alpha suffixes and the players/accents arrays are carried through

When the source palette is sane, the output is byte-identical to before — the derivation only fires on the mismatch.

Second commit: syntaxHueOffsets gains enum (240, the type offset) and variant (280, the constructor offset), so the new template scopes from Ryoku-dev/ryoku#1063 follow their siblings' hue rotation instead of staying gray under a grayscale wallpaper (found by Greptile on that PR).

Verification

  • RED: sync of the current palette produced Ryoku Dynamic Light background #131317 (luminance 0.007)
  • GREEN: after the fix, Light background #fbfbff (luminance 0.967), editor #f4f4ff, text #1f1f1f; syntax 4.50:1 and UI text 4.50:1 floors hold
  • Regression: the Dark variant is byte-identical before/after
  • enum renders the same hue as type, variant as constructor, in both variants
  • --verify-monochrome passes; tests/ryoku-zed-theme-installer.test.sh passes; tests/validate-catalogue.sh passes

Bundle bumped to 1.2.1 with refreshed manifest and registry hashes.

…nders dark

Ryoku's palette plane can render a single dark scheme into both matugen
template variants, so 'Ryoku Dynamic Light' shipped with the same dark
surfaces as Dark (background luminance ~0.01). Zed users who switch to
light mode got a dark editor while the rest of the system went light.

Sync now checks each variant's surface luminance against its declared
appearance. When they disagree, it rebuilds the variant from the opposite
one: hue and chroma are preserved, lightness is mirrored across the
source theme's own background-to-text OKLCH range (clamped to the gamut),
and the existing improve() pass re-enforces WCAG AA contrast. The dark
variant output is byte-identical to before when the source is sane.

Bump the bundle to 1.2.1 and refresh the manifest and registry hashes.
@neur0map

neur0map commented Dec 5, 2026

Copy link
Copy Markdown
Member

🦊 mika's review

No actionable findings. Mika looked for bugs, security issues, and risks in the diff and came up empty on clear defects.

⚠️ Partial run: describe: after 3 attempts: llm: hermes rate_limited; review: after 3 attempts: llm: hermes rate_limited


🦊 Generated by Mika — the Ryoku org's self-hosted AI code reviewer. Machine findings: verify before merging.

The template's new enum and variant scopes matched no rule in
syntaxHueOffsets, so the generator re-hued type and constructor while
enum and variant kept the raw palette hues. With a grayscale wallpaper
the siblings turned colored and the new scopes stayed gray. Give enum
the type offset (240) and variant the constructor offset (280) so each
follows its sibling under every palette. Verified: enum renders the
same hue as type and variant as constructor in both variants, and the
monochrome validation still passes.

Found by Greptile on Ryoku-dev/ryoku#1063.
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.

2 participants