Skip to content

feat: add dark mode with theme toggle#23

Open
GindaChen wants to merge 1 commit into
zarazhangrui:mainfrom
GindaChen:feat/dark-mode-theme-selector
Open

feat: add dark mode with theme toggle#23
GindaChen wants to merge 1 commit into
zarazhangrui:mainfrom
GindaChen:feat/dark-mode-theme-selector

Conversation

@GindaChen

Copy link
Copy Markdown

Summary

  • Dark mode as the default theme, with a light/dark toggle button in the header
  • Theme preference persists across sessions in chrome.storage.local
  • All colors remap through existing CSS var() tokens — no hardcoded overrides

Why

The current light-only theme can be harsh on the eyes, especially for users who open new tabs frequently at night. Dark mode is the most-requested visual feature for new tab extensions.

What's included

  • CSS (~25 lines): [data-theme="dark"] block remaps all 13 design tokens (ink, paper, card-bg, accents, status colors, shadow) plus a reduced paper-texture opacity. Also adds .theme-toggle button styles matching the existing action-btn design language.
  • HTML: one <button> in the header with a sun/moon SVG icon and a text label ("Light" / "Dark").
  • JS (~40 lines): loadTheme() reads from storage on page load (defaults to "dark"), applyTheme() sets the data-theme attribute and swaps the icon, toggleTheme() flips and persists.

How it works

  1. On load, loadTheme() reads chrome.storage.local.theme — if unset (first install), defaults to "dark"
  2. Sets data-theme="dark" on <html>, which activates the CSS variable overrides
  3. Click the toggle → flips to "light", saves to storage, swaps the icon to a moon
  4. Next new tab → reads the saved preference and applies it before render

Test plan

  • Fresh install (no prior storage): verify dark mode is the default
  • Toggle to light mode, verify all colors revert to the original warm paper theme
  • Toggle back to dark, verify all cards, badges, banners, and toast use dark palette
  • Close and reopen a new tab — verify theme preference persists
  • Check that the paper texture overlay is subtler in dark mode (opacity reduced)

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
arbing pushed a commit to arbing/tab-out that referenced this pull request Apr 18, 2026
- Dark mode set as default theme with light/dark toggle in header
- Theme preference persists via chrome.storage.local
- Colors managed through CSS variables (13 design tokens remapped)
- Toggle button with sun/moon SVG icon in pill-shaped style

https://claude.ai/code/session_0163Hnh7u3X82Wn4twSP7P28
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