demarkus-library journal: 2026-12-01
Issue #126 (code blocks unreadable when a theme forces color-scheme: only dark and the OS is light) fixed on branch fix/chroma-light-dark, uncommitted. Cause: library.css switches on color-scheme via light-dark(), chroma.css switched on @media (prefers-color-scheme: dark), so the two disagreed under a forcing theme. gen_chroma_css.go now emits one ruleset per class with light-dark(github, github-dark) colors; a side a palette leaves unset falls back to currentColor (text) or transparent (background); font styles follow the light palette. Only .chroma wrapper and .line { display: flex } kept from layout types (adapter renders no line numbers/highlights). User chose to keep chroma's wrapper background (light-dark(#fff, #0d1117)) over the room's pre { --wash }, so theme pre {} still loses to .chroma; themes override via .chroma. Side fix: old dark media query never reset light-only token colors (.na teal leaked into dark OS). New TestBrowserCodeFollowsColorScheme (4 cases: forced dark/light vs OS, room follows OS) fails 3/4 on old CSS. Gates: pre-commit, full browser suite, helm 46/46.
/simplify on fix/chroma-light-dark (uncommitted; pre-commit, browser suite, helm 46/46 passing). Applied: generator loops slices.Sorted(maps.Keys(StandardTypes)) inline (helper dropped), blend renamed schemeDecls; chroma.css byte-identical. Mermaid island had the same #126 root cause (matchMedia OS preference): roomIsDark() in islands.js probes light-dark(#000, #fff) on a body child so a theme's only dark counts. Test navigates once and toggles documentElement.style.colorScheme per case; new diagram subtest (inline <style> in the doc so the scheme precedes islands.js). Each fix reverted fails its own cases. Skipped: rebuilding the generator on WriteCSS + merge (layout types unused, parse-based), dropping /* Token */ comments (they name classes for theme overrides), selector grouping, hand-coded expected colors (deliberate).
/code-review on fix/chroma-light-dark: 10 findings, 9 applied (uncommitted; pre-commit, browser suite, helm 46/46 passing). Generator rebuilt on chroma's own WriteCSS (WithAllClasses so both palettes list identical rules, zipped and paired): restores .ln/.lnt/.hl/table layout that fence attrs {linenos=true, hl_lines=[2]} emit; github Background gets text #1f2328 so the white block never inherits a theme's light ink; font flags union (dark-only bold .no, .gh kept). islands.js: isDarkAt(el) probes beside the block with forced-color-adjust: none; stylesSettled() waits for pending stylesheets (3s cap for an already-failed sheet) before mermaid picks a theme; mermaid comment moved and tightened. Tests: code fixture carries .ln/.hl, comma-ok on eval, cdp.emulateScheme helper; new TestBrowserDiagramFollowsWorldScheme (boosted swap into a world whose site.css forces dark, served 300ms late). Mutations fail as expected. Deferred to debt.md: diagrams re-theming on live scheme change.