Skip to content

feat(ui): gate dark mode at build time instead of chasing regressions - #107

Merged
Luhaozhu merged 1 commit into
mainfrom
feat/dark-mode-build-guardrail
Aug 17, 2026
Merged

feat(ui): gate dark mode at build time instead of chasing regressions#107
Luhaozhu merged 1 commit into
mainfrom
feat/dark-mode-build-guardrail

Conversation

@Luhaozhu

Copy link
Copy Markdown
Contributor

Why

Dark mode kept regressing after every UI change. The root cause was a missing
feedback loop rather than a handful of missed spots: nothing failed when a
hard-coded light-only color was introduced, so regressions were only found by
looking at the app.

What

  • Adds src/frontend/scripts/check-dark-mode.mjs, a build-time checker that
    flags hard-coded light-only colors in styles and components.
  • Adds src/frontend/scripts/dark-mode-baseline.json, a committed baseline so
    the existing debt is capped and can only shrink. New violations fail the build;
    the current backlog does not.
  • Wires the check into npm run build, next to the existing i18n check, and
    exposes it as npm run check:dark.
  • Clears the violations the checker surfaced, moving colors onto theme tokens
    across the catalog, chat, settings, onboarding, ontology, loop, canvas and
    apidoc styles.
  • Turns the Word-style paper surface into an explicit light island instead of an
    untokenized leak.

Notes

The baseline is currently looser than the tree (the build reports the tree is
102 violations below it). npm run check:dark -- --update tightens it once more
of the remaining debt is paid down.

Verification

  • npm run build passes end to end: i18n check, dark-mode check, tsc -b, and
    the vite production build.

Dark mode kept regressing because nothing checked it — the root cause was a
missing feedback loop, not a handful of missed spots.

- adds `scripts/check-dark-mode.mjs`, a build-time checker that flags hard-coded
  light-only colors, plus a committed baseline so existing debt is capped and can
  only shrink
- wires the check into `npm run build`, next to the existing i18n check
- clears the violations the checker surfaced across the catalog, chat, settings,
  onboarding, ontology, loop, canvas and apidoc styles, moving them onto theme
  tokens
- the Word-style paper surface becomes an explicit light island rather than an
  untokenized leak, and the checker itself is carried into the CE overlay so the
  community build runs the same gate

The baseline is currently looser than the tree; `npm run check:dark -- --update`
tightens it once the remaining debt is paid down.
@Luhaozhu
Luhaozhu merged commit 8c35850 into main Aug 17, 2026
5 checks 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