Skip to content

Add toggleable light/dark mode#1

Open
ShawnPana wants to merge 1 commit intomainfrom
feat/light-mode-toggle
Open

Add toggleable light/dark mode#1
ShawnPana wants to merge 1 commit intomainfrom
feat/light-mode-toggle

Conversation

@ShawnPana
Copy link
Collaborator

@ShawnPana ShawnPana commented Mar 5, 2026

Summary

  • Adds a light/dark mode toggle button (sun/moon icon) to the settings bar on the home page and the session page header
  • Theme preference is persisted to localStorage and defaults to dark mode, preserving the existing look
  • All components updated with Tailwind dark: variants for proper light mode styling

Changes

Area What changed
tailwind.config.ts Enabled darkMode: "class" strategy
src/context/theme-context.tsx New ThemeProvider + useTheme hook with localStorage persistence
src/components/theme-toggle.tsx New ThemeToggle button component (sun/moon icons from lucide)
src/app/layout.tsx Wrapped app in ThemeProvider, set class="dark" on <html> by default
src/app/globals.css Added light mode base + dark: body styles
All components Added dark: Tailwind variants alongside light mode base colors

Screenshots

Dark mode (default):
The existing dark UI is fully preserved -- no visual changes when the toggle is set to dark.

Light mode:
Clean light theme with white/zinc-100 backgrounds, proper contrast, and matching borders/text colors.


Summary by cubic

Adds a light/dark theme toggle (sun/moon) in the settings bar and session header. Introduces a ThemeProvider with localStorage persistence, enables Tailwind darkMode: class, sets the html element to dark by default, and updates component styles for proper light mode.

Written for commit 57ed918. Summary will update on new commits.

- Add ThemeContext with localStorage persistence (defaults to dark)
- Enable Tailwind class-based dark mode strategy
- Add dark: variants to all components for proper light mode styling
- Add ThemeToggle button (sun/moon icon) in SettingsBar and session page
- Wire ThemeProvider into root layout
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 15 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/app/layout.tsx">

<violation number="1" location="src/app/layout.tsx:24">
P2: Hard-coding `className="dark"` on `<html>` forces an incorrect initial theme for users who previously selected light mode, causing a dark-to-light flash after hydration.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.


return (
<html lang="en">
<html lang="en" className="dark">
Copy link

@cubic-dev-ai cubic-dev-ai bot Mar 5, 2026

Choose a reason for hiding this comment

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

P2: Hard-coding className="dark" on <html> forces an incorrect initial theme for users who previously selected light mode, causing a dark-to-light flash after hydration.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/app/layout.tsx, line 24:

<comment>Hard-coding `className="dark"` on `<html>` forces an incorrect initial theme for users who previously selected light mode, causing a dark-to-light flash after hydration.</comment>

<file context>
@@ -20,10 +21,12 @@ export default function RootLayout({
 
   return (
-    <html lang="en">
+    <html lang="en" className="dark">
       <body className="min-h-screen">
         <QueryClientProvider client={queryClient}>
</file context>
Fix with Cubic

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