fix: use theme-aware syntax colors for preview code blocks#388
Open
kwame-Owusu wants to merge 2 commits into
Open
fix: use theme-aware syntax colors for preview code blocks#388kwame-Owusu wants to merge 2 commits into
kwame-Owusu wants to merge 2 commits into
Conversation
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.
fixes #239
Description
Preview mode rendered code blocks with highlight.js's hardcoded atom-one-light palette, producing the same fixed light-theme colors regardless of the active ZenNotes theme. On dark themes this caused jarring bright code blocks that clashed with the rest of the UI, and the colors didn't match what users saw in edit mode.
Fix
Override the hljs-* token classes with the same CSS variables the editor uses (--z-accent, --z-green, --z-yellow, etc.), scoped to .prose-zen so only preview mode is affected. Preview code blocks now use identical colors to edit mode and adapt to every theme automatically.
Changes
As the screenshots below depict, after the changes the preview mode colors adhere more to the original theme that we set in zennotes, instead of using a blanket atom theme for all.