You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(cli): sync scaffold dark mode so ui-* components follow the theme (#101)
* fix(cli): sync scaffold dark mode so ui-* components follow the theme
The default scaffold shipped two unsynced theme systems: the editorial
chrome tokens (--fg/--bg) toggled via a `data-theme` attribute, while
the copied shadcn ui-* components (button, card, alert, etc.) key their
dark tokens off a `.dark` class (`@custom-variant dark (&:is(.dark *))`).
Nothing ever set `.dark`, so every ui component was frozen in light
tokens. On the dark-default chrome this rendered, e.g., the outline
"View docs" button as white-on-light (invisible text) and cards as
white boxes. Light mode looked fine only because both systems were
light then.
Fix: the head init script and the theme-toggle now toggle a `.dark`
class in sync with the effective theme (dark by default unless the OS
prefers light or 'light' is chosen), and the head script re-applies on
OS theme changes. The chrome's `data-theme` mechanism is unchanged; the
`.dark` class simply drives the shadcn tokens alongside it.
Verified in a browser (emulated dark): outline button now renders with
the dark input tint + light text, cards render dark, and light mode is
unchanged.
* docs+test: document and guard the scaffold dark-mode dual-signal
Codify why dark mode broke while light worked so it can't recur silently:
- agent-docs/styling.md: new "Dark mode" section explaining the two
theming signals (data-theme for the editorial chrome, .dark class for
the Webjs UI kit), that a theme switch must drive both, and that light
mode passing proves nothing about dark mode.
- agent-docs/testing.md: a "Verifying UI and theming" note: render in a
real browser, test both themes, inspect computed styles, read the
screenshot, and guard the wiring in a fast test.
- test/scaffolds/scaffold-integration.test.js: assert the generated
layout head script AND theme-toggle both toggle the `.dark` class, so
the sync mechanism can't regress unnoticed.
- templates/CONVENTIONS.md: a scaffolded-app note mirroring the
dual-signal rule for agents working inside a user app.
0 commit comments