Repository navigation
feat(docs): theme code blocks via CSS classes for light mode - #96
Merged
Merged
Conversation
Deploying dang with
|
| Latest commit: |
a791715
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://fb202e9d.dang-3kk.pages.dev |
| Branch Preview URL: | https://docs-feedback-light-mode-cod.dang-3kk.pages.dev |
vito
force-pushed
the
docs-feedback-light-mode-code-palette
branch
from
June 5, 2026 13:38
bfcf310 to
1aac252
Compare
Code blocks were stuck on the dark GitHub palette in light mode. chroma highlighted them at build time with inline style attributes, so the colors were baked into the markup and ignored the light --code-bg variable; the playground and REPL editors were likewise pinned dark. The result was a dark code island on an otherwise light page. Turn on baselit.HighlightWithClasses so static highlighting emits chroma CSS classes instead of inline styles, and render the dark and light palettes (the single source of truth, defined in plugin.go) to chroma.css via a new gen-chroma-css step in build.sh, with the light palette scoped under prefers-color-scheme:light. The stdlib signature highlighter follows the same toggle. The playground and REPL highlight client-side with .tok-* classes, so page.tmpl flips their editor surfaces and recolors those classes in light mode to match. Requires the HighlightWithClasses toggle added in github.com/vito/booklit, which the booklit pin is bumped to pick up. Signed-off-by: Alex Suraci <[email protected]>
vito
force-pushed
the
docs-feedback-light-mode-code-palette
branch
from
June 5, 2026 14:12
1aac252 to
a791715
Compare
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.
Feedback
In light mode the docs' code blocks stayed on the dark GitHub palette — a dark code island on an otherwise light page.
Root cause
chroma highlights static code blocks at build time with inline
style="color:#…"attributes (booklit'sbaselit/chromaplugins hardcodehtml.New()). Inline colors are baked into the markup, so they ignore the light--code-bgvariable and can't be re-themed by CSS. The playground/REPL editors were likewise pinned dark.Approach (deep fix, replaces the earlier hex-remap)
The first cut remapped each inline hex via CSS attribute selectors +
!important. This replaces that with class-based highlighting:HighlightWithClassestoggle (feat(baselit): optional class-based syntax highlighting booklit#63, merged) so highlighting can emit chroma CSS classes instead of inline styles. The booklit pin is bumped to the merged commit.plugin.goas the single source of truth and render them tochroma.cssvia a newgen-chroma-cssbuild step (light palette scoped underprefers-color-scheme:light). The stdlib signature highlighter follows the same toggle..tok-*classes, sopage.tmplflips their editor surfaces and recolors those classes in light mode to match.Result: every code surface is class-based and themed from CSS — no inline colors, no
!important, coversdang/sh/toml. Dark mode is unchanged.Worth eyeballing on the preview deploy in a light-mode browser.