feat(cli): add dark/light theme toggle to local preview - #92
Merged
Conversation
Match the hosted viewer: pill switch in a top-right chrome cluster instead of a labeled button under the TOC.
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.
Summary
file://one-shot and--watch/ runner on127.0.0.1:7821) so it stays visually in lockstep with the hosted viewer.<head>(html[data-theme]) before first paint. Preference lives inlocalStorage['gander-theme']("light"|"dark"); absence follows the OS.try/catcharoundlocalStoragecovers Safarifile://SecurityError.aria-pressed. Desktop-with-TOC: under the logo. No-TOC / mobile: left-aligned.gander-md-toolbar. Both sit outside#content-bodyso watch reloads do not eat them.@10nowinitializes withdark/default, stashes source ondata-gander-mermaid, and serializes overlappingrun()on an in-flight Promise. Logo SVG usesfill="currentColor". Light palette is unchanged (bodyuses--gander-bg).Related Issue
Closes #91
Paired with the hosted viewer (visual contract, not API): gandermd/gandermd#55.
Testing
go test ./...go vet ./...go build ./...CGO_ENABLED=0 go build -o gander .Notes
Token table, boot, and toggle scripts are a copy of gandermd
internal/render/theme.go(no shared Go module). Persistence does not crossfile://,127.0.0.1:7821, andhttps://gander.md— acceptable per the design. A slipped CLI release does not block server deploy.