Add dark/light/system theme chooser to workshop docs menu#1992
Merged
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
pelikhan
July 25, 2026 03:48
View session
pelikhan
reviewed
Jul 25, 2026
| <link rel="stylesheet" href="primer.css"> | ||
| <link rel="stylesheet" href="alerts.css"> | ||
| <link rel="stylesheet" href="docs.css"> | ||
| <script>(function(){var t=localStorage.getItem('workshop-color-mode');if(t==='light'||t==='dark'||t==='auto')document.documentElement.setAttribute('data-color-mode',t);}());</script> |
Contributor
Author
There was a problem hiding this comment.
Done. Theme logic is now in scripts/static/docs-theme.js and copied to dist/docs-theme.js at build time. The HTML references it via <script src="docs-theme.js"> — no inline theme JS remains. (commit: Extract theme JS to scripts/static/docs-theme.js)
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
pelikhan
approved these changes
Jul 25, 2026
pelikhan
marked this pull request as ready for review
July 25, 2026 03:54
pelikhan
reviewed
Jul 25, 2026
| @@ -0,0 +1,22 @@ | |||
| (function () { | |||
| var THEME_KEY = 'workshop-color-mode'; | |||
Contributor
Author
There was a problem hiding this comment.
Done — THEME_KEY is now 'gh-aw-workshop-color-mode' (commit: Prefix localStorage key with gh-aw-).
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
pelikhan
approved these changes
Jul 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a persistent theme chooser (Light / System / Dark) to the workshop docs sidebar menu, stored in
localStorage.Changes
<head>script applies storeddata-color-modebefore paint to eliminate flash of wrong themearia-pressed@media (prefers-color-scheme: dark)blocks narrowed tohtml[data-color-mode="auto"]; added matchinghtml[data-color-mode="dark"]rules so custom CSS variables (link colors, nav buttons) respond to forced-dark mode, not just system preferenceapplyTheme(theme)setsdata-color-modeon<html>and syncsaria-pressed; click handler persists tolocalStorage