Skip to content

Enhancement os aware dark/light theme persistence#223

Open
amoduenechojo wants to merge 2 commits into
SwiftChainn:mainfrom
amoduenechojo:Enhancement-OS-Aware-Dark/Light-Theme-Persistence
Open

Enhancement os aware dark/light theme persistence#223
amoduenechojo wants to merge 2 commits into
SwiftChainn:mainfrom
amoduenechojo:Enhancement-OS-Aware-Dark/Light-Theme-Persistence

Conversation

@amoduenechojo

Copy link
Copy Markdown

#closes
#166

The theme experience now behaves as requested:

The app checks the user’s OS preference with matchMedia on initial load.
A manual theme choice is saved to localStorage and takes precedence over the OS default.
A blocking inline script applies the theme class before React hydrates, preventing the opposite theme from flashing.
What changed
Added browser-side theme initialization and persistence logic in themeService.ts
Updated the theme hook in useTheme.ts to initialize from stored/local preference first, then fall back safely
Wired the pre-hydration theme script into layout.tsx
Kept the theme provider aligned in providers.tsx
Added regression coverage in useTheme.test.ts

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