Add a light, dark and system theme switch

Open
#127 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
Half a day
Newbie friendliness
62/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
css, html, react, typescript
Domain
frontend

Research direction

Start with the tokens in apps/web/src/styles/theme.css and the prefers-color-scheme rule, then see how apps/web/src/styles/global.css uses them. Add the System/Light/Dark choice to apps/web/src/pages/SettingsPage.tsx, and set data-theme on <html> from a small inline script in apps/web/index.html. Done when the choice persists, System follows the OS live, and storage-blocked still works; update docs/CSP.md for the new script hash.

Written by the indexing model from the issue text.

Description

enhancement good first issue web

Difficulty: Beginner to Intermediate · Estimated size: half a day

Context

The theme follows the operating system only (prefers-color-scheme in apps/web/src/styles/theme.css). Some people want a different theme from their system.

Problem or goal

Add a three-way choice (System, Light, Dark) in Settings that is remembered.

Suggested approach

  • Set data-theme="light" or "dark" on <html> and make the CSS tokens react to it, keeping the system behaviour when the choice is System.
  • Store the choice in localStorage inside try/catch and apply it before the first paint with a tiny inline script in index.html, so there is no flash of the wrong theme. (A new inline script changes the CSP hash list in docs/CSP.md.)
  • Update the theme-color meta tag to match.

Where to look

  • apps/web/src/styles/global.css and theme.css
  • apps/web/index.html
  • apps/web/src/pages/SettingsPage.tsx

Acceptance criteria

  • No flash of the wrong theme on reload.
  • The choice persists and System still follows the OS live.
  • Contrast stays acceptable in both themes.
  • Works with storage blocked.

How to work on it

  1. Comment here to claim it, so two people do not do the same work.
  2. Fork the repo and branch from main (feat/short-name or fix/short-name). Setup steps are in docs/DEVELOPMENT.md.
  3. Keep the change focused and add tests for backend logic.
  4. Run npm run typecheck, npm test and npm run lint and npm run format before opening the pull request.
  5. Use a Conventional Commits title (for example feat(web): add bookmarks). More in CONTRIBUTING.md.

Stuck? Ask in this issue. Questions are welcome.


Generated by Claude Code

Dominant language
TypeScript
Stars
6
Forks
6
Avg merge
1h 59m
Merged PRs (30d)
59

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Haseeb-MernStack/commune

All issues in Haseeb-MernStack/commune

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.