Skip to content

fix: use theme-aware syntax colors for preview code blocks#388

Open
kwame-Owusu wants to merge 2 commits into
ZenNotes:mainfrom
kwame-Owusu:fix/preview-code-block-theme-colors
Open

fix: use theme-aware syntax colors for preview code blocks#388
kwame-Owusu wants to merge 2 commits into
ZenNotes:mainfrom
kwame-Owusu:fix/preview-code-block-theme-colors

Conversation

@kwame-Owusu

Copy link
Copy Markdown

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.

catpuccin-before catpuccin-after

@kwame-Owusu
kwame-Owusu requested a review from adibhanna as a code owner July 13, 2026 21:42
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.

Feature Request : Better code block colors for preview mode

1 participant