Skip to content

Refresh design tokens and add a system theme preference - #32

Merged
fyui001 merged 3 commits into
NewWorldOrg:masterfrom
fyui001:design/theme-foundation-refresh
Jul 9, 2026
Merged

fyui001 merged 3 commits into
NewWorldOrg:masterfrom
fyui001:design/theme-foundation-refresh

Conversation

@fyui001

@fyui001 fyui001 commented Jul 9, 2026

Copy link
Copy Markdown
Member

Summary

  • Unify the color system on a neutral zinc palette (the blue-tinted primary is dropped) and add success / warning / info and table-header tokens for future use.
  • Fix several theming bugs:
    • dark: utilities previously followed the OS media query instead of the .dark class (no @custom-variant dark), so OS-dark users saw dark styles leak into the light theme.
    • --destructive-foreground was the same value as --destructive in both modes, making destructive button labels unreadable.
    • The middleware matcher skipped / and /auth/login, so those pages always rendered light regardless of the saved theme.
    • The focus ring color now matches the primary color for a >= 3:1 contrast ratio (WCAG 2.4.11).
  • Extend the theme to a light / dark / system preference:
    • Explicit choices render the dark class at SSR (no flash), and system is resolved by a constant inline script before hydration.
    • The header toggle becomes a three-option dropdown; the display settings switch becomes a select.
  • Storybook: light/dark toolbar wired to the ThemeProvider, @storybook/addon-a11y (test: 'todo'), and stories updated for the new APIs.

Behavior notes

  • First visits with no saved preference now follow the OS color scheme (previously always light).
  • When the preference is system and the OS is dark, BlockNote's JS-driven editor colors can lag one frame after mount; the page CSS itself is correct from first paint.

Verification

  • yarn typecheck / yarn lint / yarn build green.
  • Playwright checks on the running app: SSR renders class="dark" for the dark cookie, injects the no-flash script only for system/unset, the login page honors the saved theme, and /logout / /debug-auth behave as before.
  • Storybook stories screenshot-verified in both themes; toggle and settings select interactions verified (cookie + class updates).

fyui001 added 2 commits July 10, 2026 01:44
Unify the color system on zinc, dropping the blue-tinted primary.
Add class-based dark variant wiring, color-scheme declarations,
success/warning/info and table-header tokens, a high-contrast focus
ring, readable destructive foreground in both modes, and a
number-input spinner reset.
Extend the theme from a light/dark toggle to a light/dark/system
preference. The middleware forwards the cookie on every page (the
login page previously never received the theme header and always
rendered light), the layout sets the dark class at SSR for explicit
choices, and an inline no-flash script resolves the OS scheme before
hydration when the preference is system.

The header toggle becomes a three-option dropdown, the display
settings switch becomes a select, and Storybook gains a light/dark
toolbar plus the a11y addon.
@fyui001 fyui001 self-assigned this Jul 9, 2026
Key the preview ThemeProvider by the toolbar theme so its state
re-initializes when switching, and add SameSite=Lax to the sidebar
cookie for parity with the theme cookie.
@fyui001
fyui001 merged commit fa05109 into NewWorldOrg:master Jul 9, 2026
2 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