Skip to content

Add persisted theme toggle helper#87

Open
tristanwork wants to merge 4 commits into
labmain:mainfrom
tristanwork:main
Open

Add persisted theme toggle helper#87
tristanwork wants to merge 4 commits into
labmain:mainfrom
tristanwork:main

Conversation

@tristanwork

Copy link
Copy Markdown

Summary

  • add a framework-agnostic theme toggle helper for navbar mounting
  • persist light/dark preference in localStorage
  • apply theme state to document attributes/classes and button accessibility labels
  • add no-dependency tests for storage, initial theme, DOM application, and click toggling

Verification

  • npm test
Field Value
Bounty $50 USD1
Wallet 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb7

Fixes #19

@tristanwork

Copy link
Copy Markdown
Author

Follow-up after commit b4ad3fc:

  • Added installNavbarThemeToggle() so the toggle can be installed directly into a navbar.
  • Added smooth transition CSS injection for background, text, and border color changes.
  • Added theme-demo.html, which shows the visible navbar toggle in a browser page.
  • Expanded tests for style injection, idempotent install, and navbar mounting.

Local verification: npm test passes with parser tests 6/6 and theme toggle tests 27/27.

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.

Support dark/light theme toggle

1 participant