Skip to content

Fix dark editor theme bleeding into light preview#167

Open
andrejkurusiov wants to merge 1 commit into
mjbvz:masterfrom
andrejkurusiov:master
Open

Fix dark editor theme bleeding into light preview#167
andrejkurusiov wants to merge 1 commit into
mjbvz:masterfrom
andrejkurusiov:master

Conversation

@andrejkurusiov
Copy link
Copy Markdown

Fixes #165

Summary

When using a dark VS Code editor theme with colorTheme forced to light, headings, code blocks, links, borders, and other elements render with dark-theme colours instead of the GitHub light palette.

VS Code's built-in markdown.css styles elements using --vscode-* CSS variables, which resolve to dark-theme values from the editor. base.css did not override them.

Changes

  • Remap --vscode-editor-foreground, --vscode-foreground, --vscode-textCodeBlock-background, --vscode-widget-border, and --vscode-editor-font-family within .github-markdown-body to the extension's own theme variables
  • Add !important overrides on headings, links, code blocks, blockquotes, tables, and hr
  • Bump version to 2.2.1

Test plan

  • Set workbench.colorTheme to any dark theme (e.g. One Dark Pro Darker)
  • Set markdown-preview-github-styles.colorTheme to light
  • Open a markdown file containing headings, code blocks, links, tables, blockquotes, and hr
  • Verify all elements use GitHub light-theme colours
  • Switch colorTheme to auto and dark, verify no regressions

VS Code's built-in markdown.css styles elements using --vscode-*
CSS variables, which resolve to dark-theme values when the editor
uses a dark theme. This causes headings, code blocks, links,
borders, and other elements to render with dark-theme colours even
when colorTheme is forced to light.

Remap --vscode-* variables within .github-markdown-body to the
extension's own GitHub theme variables, and add !important overrides
on affected elements to ensure full isolation.

Relates to: mjbvz#48
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.

Dark editor theme bleeds into preview when colorTheme is forced to light

1 participant