Skip to content

feat(ui): dark mode with system-follow and manual toggle - #94

Merged
Luhaozhu merged 2 commits into
mainfrom
feat/dark-mode
Aug 15, 2026
Merged

feat(ui): dark mode with system-follow and manual toggle#94
Luhaozhu merged 2 commits into
mainfrom
feat/dark-mode

Conversation

@Luhaozhu

Copy link
Copy Markdown
Contributor

What

Adds full dark mode support to the frontend.

  • New Appearance setting under Settings → Session settings with three options: Follow system / Light / Dark. Switching applies instantly — no reload.
  • In Follow system mode the UI reacts live to OS appearance changes via a prefers-color-scheme subscription.
  • An inline boot script in index.html applies the stored theme before first paint, so dark-mode users no longer get a white flash on load.
  • Share preview pages intentionally stay light so shared content renders exactly as authored.

How

  • src/theme.ts is the single source of truth for mode parsing, persistence (localStorage), and DOM application (<html data-theme="dark"> + color-scheme).
  • AppThemeProvider wraps the antd ConfigProvider, switching between defaultAlgorithm/darkAlgorithm with matching token sets.
  • variables.css gains semantic background layers (base/container/elevated/layout) and a complete dark override block; scrollbar colors are tokenized.
  • ~1300 hardcoded colors across the stylesheets were migrated to design tokens / color-mix() derivations, so both themes resolve from a single palette. Translucent glass surfaces and scroll-edge fade masks adapt automatically.
  • Dark-specific overrides are kept to the few spots where assets cannot flip via tokens: sidebar SVG icons are brightened, the hero artwork is dimmed, and the docx preview keeps its white paper.

Testing

  • npm run build passes (type-check + i18n check + vite) on this tree.
  • Verified light mode is pixel-faithful to the previous rendering; dark mode checked across home, conversation, My Space, scheduled tasks, and settings via real-stack screenshots.
  • Live OS light/dark flip verified in Follow system mode without reload.

Luhaozhu added 2 commits August 14, 2026 05:42
- New Appearance setting (follow system / light / dark) under Settings → Session settings, switching instantly without a reload
- Theme infrastructure: theme.ts as the single source for mode parsing/persistence/DOM application; AppThemeProvider wraps antd ConfigProvider with darkAlgorithm and subscribes to prefers-color-scheme so the system-follow mode flips live
- Design tokens: semantic background layers (base/container/elevated/layout) and a full dark override block in variables.css; scrollbar colors tokenized
- Migrated ~1300 hardcoded colors across stylesheets to tokens/color-mix so both themes derive from a single palette; translucent glass surfaces and scroll-edge fades adapt automatically
- Anti-FOUC inline boot script in index.html applies the stored theme before first paint; share preview pages stay light so shared content renders as authored
- Dark-specific overrides only where assets cannot flip via tokens: sidebar SVG icons brightened, hero artwork dimmed, docx preview keeps its white paper
The download-card filename used a stray hardcoded gray-900 rgba that never
flipped with the theme; tokenized it together with the card's light-blue-gray
borders, the file-badge gradient, and the download button's blue border so the
whole card derives from the palette in both themes.
@Luhaozhu
Luhaozhu merged commit 3c1bd36 into main Aug 15, 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