Skip to content

feat(ui): light/dark theme toggle (#28) - #45

Merged
ArianAr merged 1 commit into
mainfrom
feat/28-theme-toggle
Jul 15, 2026
Merged

feat(ui): light/dark theme toggle (#28)#45
ArianAr merged 1 commit into
mainfrom
feat/28-theme-toggle

Conversation

@ArianAr

@ArianAr ArianAr commented Jul 15, 2026

Copy link
Copy Markdown
Owner

Summary

Closes #28 only.

  • VS Code dark (default) + light palettes via CSS variables / data-theme
  • Preference stored in localStorage (papercut-theme)
  • Inline boot script avoids flash of wrong theme
  • Toggle on home, canvas header, password gate, 404

Test plan

  • pnpm test (55)
  • lint / typecheck / build
  • CI green
  • Manual: toggle persists across reload

Closes #28

Add data-theme CSS variables, ThemeToggle with localStorage persistence,
and FOUC-free boot script. Toggle on home, paste canvas, password gate,
and not-found. Closes #28.
@ArianAr ArianAr added enhancement New feature or request area:ui Log canvas and web UI labels Jul 15, 2026

@ArianAr ArianAr left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review

Verdict: Approve

Scope: #28 only.

Strengths

  • Theme tokens as RGB CSS variables keep Tailwind opacity (/40) working
  • Separate light/dark ANSI palettes
  • FOUC boot script + suppressHydrationWarning on <html>
  • localStorage only (no tracking); defaults to dark
  • Pure theme helpers unit-tested

Minor notes

  • not-found imports a client toggle (fine in App Router)
  • Theme is per-browser, not per-paste (as specified)

Merge when CI green.

Comment thread server/lib/theme.ts
}

/** Inline script: set data-theme before paint (no FOUC). */
export const THEME_BOOT_SCRIPT = `(function(){try{var k=${JSON.stringify(THEME_STORAGE_KEY)};var t=localStorage.getItem(k);if(t!=="light"&&t!=="dark")t="dark";document.documentElement.setAttribute("data-theme",t);}catch(e){document.documentElement.setAttribute("data-theme","dark");}})();`;
@ArianAr
ArianAr merged commit 4e661cb into main Jul 15, 2026
9 of 10 checks passed
@ArianAr
ArianAr deleted the feat/28-theme-toggle branch July 15, 2026 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ui Log canvas and web UI enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UI: light/dark toggle (VS Code aesthetic)

2 participants