Skip to content

fix: Respect OS theme preference on first load#186

Open
Ruchika083 wants to merge 4 commits into
imDarshanGK:mainfrom
Ruchika083:fix-theme-prefers-color-scheme
Open

fix: Respect OS theme preference on first load#186
Ruchika083 wants to merge 4 commits into
imDarshanGK:mainfrom
Ruchika083:fix-theme-prefers-color-scheme

Conversation

@Ruchika083
Copy link
Copy Markdown

@Ruchika083 Ruchika083 commented May 20, 2026

Summary

Updated the frontend theme initialization logic to respect the user's OS-level prefers-color-scheme setting on first load.

Changes Made

  • Use saved theme from localStorage if available
  • Fallback to prefers-color-scheme when no saved theme exists
  • Preserve existing manual theme toggle behavior

Files Changed

  • frontend/index.html

closes #178

Attached screenshots showing the app correctly respecting OS-level theme preference on first load.

  • Light OS preference → app loads light theme
LIGHTMODE
  • Dark OS preference → app loads dark theme
DARK MODE

@Ruchika083
Copy link
Copy Markdown
Author

Hi @imDarshanGK, please let me know if there are any changes needed from my side for the above.

@imDarshanGK
Copy link
Copy Markdown
Owner

@Ruchika083 Could you please attach the related issue number to this PR for proper tracking?
and Before review, please include screenshots or demo output for the implemented feature/fix.

@Ruchika083 Ruchika083 requested a review from imDarshanGK as a code owner May 21, 2026 10:41
@Ruchika083
Copy link
Copy Markdown
Author

@imDarshanGK ,
I have updated the PR with related issue number and added screenshots showing the implementation of the fix.

Copy link
Copy Markdown
Owner

@imDarshanGK imDarshanGK left a comment

Choose a reason for hiding this comment

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

@imDarshanGK Please fix the [] attribute regression in [index.html]. The diff changes data-theme to en, which breaks theme initialization. After correcting that, the prefers-color-scheme startup logic can be re-reviewed.

@Ruchika083
Copy link
Copy Markdown
Author

@imDarshanGK , I have made the changes, please let me know if there are any changes needed from my side for the above.

Copy link
Copy Markdown
Owner

@imDarshanGK imDarshanGK left a comment

Choose a reason for hiding this comment

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

The theme-preference fix looks correct and does address issue #178, but this PR is not merge-ready yet because the diff also removes unrelated backend digest files that are already on main. Please rebase this branch onto the latest main and keep only the frontend theme initialization change. After that I can approve and merge.

@Ruchika083 Ruchika083 force-pushed the fix-theme-prefers-color-scheme branch from 78aac52 to 20879b6 Compare May 22, 2026 14:38
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.

Add OS-level dark mode detection on first load

2 participants