Skip to content

Feat: Add persistent dark theme toggle with localStorage state caching#335

Merged
komalharshita merged 7 commits into
komalharshita:mainfrom
Siddh2024:feat-dark-mode
Jun 2, 2026
Merged

Feat: Add persistent dark theme toggle with localStorage state caching#335
komalharshita merged 7 commits into
komalharshita:mainfrom
Siddh2024:feat-dark-mode

Conversation

@Siddh2024
Copy link
Copy Markdown
Contributor

Summary

This Pull Request introduces a native, persistent Dark Mode toggle feature across the DevPath platform. To achieve this, core color tokens (background surfaces, card containers, tech stack badges, and typography) have been refactored into global CSS variables. A lightweight JavaScript event handler handles toggling a data-theme="dark" attribute on the document root, and the selected preference is securely cached in localStorage to ensure continuity across page reloads and transitions.

Related Issue

Closes #318

Visuals (Screenshots/Videos):

Screenshot 2026-05-19 150437 Screenshot 2026-05-19 150454 Screenshot 2026-05-19 150521

Local Dark Mode Previews:

Checklist [required]

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • My changes generate no new warnings

@vercel
Copy link
Copy Markdown

vercel Bot commented May 19, 2026

@Siddh2024 is attempting to deploy a commit to the komalsony234-1530's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Thank you for submitting your first pull request to DevPath.

Before review:

  • Complete the PR template fully
  • Ensure all tests pass
  • Link your PR to an issue
  • Keep changes scoped to the issue

A maintainer will review your contribution soon.

@Siddh2024
Copy link
Copy Markdown
Contributor Author

@komalharshita , kindly approve my pr request ma'am.

@Siddh2024
Copy link
Copy Markdown
Contributor Author

@komalharshita please approve and merge this code ma'am.

Copy link
Copy Markdown
Owner

@komalharshita komalharshita left a comment

Choose a reason for hiding this comment

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

Good feature contribution overall — the implementation is fairly clean and the persistent theme behavior is thoughtfully handled. The use of localStorage, system preference detection, and reusable toggle behavior are all solid additions.

Before merge, a few improvements are needed:

  • Theme initialization currently happens after script load, which can cause a flash of incorrect theme (FOUC) before dark mode is applied.
  • The stored-theme logic permanently disables future OS theme sync once a preference exists. Please clarify/document whether this behavior is intentional.
  • The toggle markup is duplicated across multiple templates, which creates maintainability overhead.
  • Add accessibility state handling such as aria-pressed so screen readers can identify the active theme state.
  • Please verify reduced-motion/transition behavior and ensure dark-mode accessibility contrast is fully validated across all pages/components.

Overall this is a strong contribution, but a few accessibility and maintainability concerns should be addressed before approval.

@Siddh2024 Siddh2024 requested a review from komalharshita May 25, 2026 17:48
@Siddh2024
Copy link
Copy Markdown
Contributor Author

@komalharshita , ma'am you can review the changes , i have made to satisfy the requirements.

@Siddh2024
Copy link
Copy Markdown
Contributor Author

Good feature contribution overall — the implementation is fairly clean and the persistent theme behavior is thoughtfully handled. The use of localStorage, system preference detection, and reusable toggle behavior are all solid additions.

Before merge, a few improvements are needed:

  • Theme initialization currently happens after script load, which can cause a flash of incorrect theme (FOUC) before dark mode is applied.
  • The stored-theme logic permanently disables future OS theme sync once a preference exists. Please clarify/document whether this behavior is intentional.
  • The toggle markup is duplicated across multiple templates, which creates maintainability overhead.
  • Add accessibility state handling such as aria-pressed so screen readers can identify the active theme state.
  • Please verify reduced-motion/transition behavior and ensure dark-mode accessibility contrast is fully validated across all pages/components.

Overall this is a strong contribution, but a few accessibility and maintainability concerns should be addressed before approval.

@komalharshita , Ma'am , i have done the changes , can you review ad approve this PR ?. THanks.

Copy link
Copy Markdown
Owner

@komalharshita komalharshita left a comment

Choose a reason for hiding this comment

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

Thanks for addressing the previous review feedback.

I reviewed the updated implementation and the dark mode design looks good. The improvements around theme initialization, accessibility (aria-pressed), reusable partials, and maintainability are appreciated.

At this point, the main blocker appears to be the merge conflicts, likely because another dark mode/theme-related PR has already been merged into the project.

Please sync your branch with the latest main, resolve the merge conflicts, and verify that the dark mode behavior still works correctly after rebasing (theme toggle, persistence, accessibility states, and page-wide styling).

Once the conflicts are resolved and the updated branch is pushed, I'll do a final review and I'm happy to merge the PR if everything remains stable.

Nice work overall.

@Siddh2024
Copy link
Copy Markdown
Contributor Author

@komalharshita , Conflicts solved ma'am,

Copy link
Copy Markdown
Owner

@komalharshita komalharshita left a comment

Choose a reason for hiding this comment

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

only resolving the merge conflicts remain

@Siddh2024
Copy link
Copy Markdown
Contributor Author

@komalharshita , done maam.

@komalharshita
Copy link
Copy Markdown
Owner

Okay, approved for merge!

@komalharshita komalharshita merged commit 3467547 into komalharshita:main Jun 2, 2026
7 of 8 checks passed
@komalharshita komalharshita added gssoc:approved and removed need review Further information is requested labels Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request]: Add persistent Dark Mode support to the DevPath platform.

2 participants