Skip to content

feat(web): add light/dark theme toggle button to rendered page#4

Merged
tjhop merged 1 commit into
mainfrom
feat/add-theme-toggle-button
Mar 20, 2026
Merged

feat(web): add light/dark theme toggle button to rendered page#4
tjhop merged 1 commit into
mainfrom
feat/add-theme-toggle-button

Conversation

@tjhop

@tjhop tjhop commented Mar 20, 2026

Copy link
Copy Markdown
Owner

Add a light/dark theme toggle button in the page header that allows
switching themes independently of the editor's g:mkdp_theme setting. The
user's choice is persisted in localStorage and takes priority over
incoming editor theme data until the page is reloaded without a saved
preference.

Changes:

  • Add toggle button element to index.html header
  • Add explicit [data-theme] CSS custom property blocks for both light
    and dark themes, including full github-markdown.css variable overrides
  • Add toggle click handler with localStorage persistence and a
    _userThemeOverride flag to prevent editor theme data from clobbering
    the user's manual choice
  • Move data-theme attribute from to for broader scope

Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com
Signed-off-by: TJ Hoplock t.hoplock@gmail.com

Add a light/dark theme toggle button in the page header that allows
switching themes independently of the editor's g:mkdp_theme setting. The
user's choice is persisted in localStorage and takes priority over
incoming editor theme data until the page is reloaded without a saved
preference.

Changes:
- Add toggle button element to index.html header
- Add explicit [data-theme] CSS custom property blocks for both light
  and dark themes, including full github-markdown.css variable overrides
- Add toggle click handler with localStorage persistence and a
  _userThemeOverride flag to prevent editor theme data from clobbering
  the user's manual choice
- Move data-theme attribute from <main> to <html> for broader scope

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: TJ Hoplock <t.hoplock@gmail.com>
@tjhop tjhop merged commit cb3469c into main Mar 20, 2026
2 checks passed
@tjhop tjhop deleted the feat/add-theme-toggle-button branch March 20, 2026 02:01
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