Skip to content

Math formulas render in black in VS Code preview when using dark theme #861

@kv9898

Description

@kv9898

Bug description

Summary
Math formulas (KaTeX/LaTeX) in Quarto .qmd preview are rendered in black text regardless of the editor theme. On dark themes that makes inline and display math unreadable.

Reproduction steps

  1. Open VS Code and activate a dark theme (e.g., "Dark+ (default dark)").
  2. Create a Quarto markdown file (formula.qmd) with a math block, for example:
---
title: "Untitled"
format: html
---
# Example formula

This is a formula:

$$
E = mc^2
$$
  1. Open the Quarto/preview pane (Preview in extension) for the file.
  2. Observe the rendered formula text (inline or display math) is black on the dark background.

Actual behavior
Rendered math text is pure black (or a fixed dark color), making it illegible on dark backgrounds.

From the code:

Image

From the sidebar:

Image

Expected behavior
Math should inherit the appropriate foreground color from the preview theme or use the editor/preview text color so it remains readable with dark themes. In short: math should respect the page/theme color rather than force black.

Minimal example
Use the YAML/sample above (paste into formula.qmd) — reproduces immediately in preview.

Steps to reproduce

No response

Actual behavior

No response

Expected behavior

No response

Your environment

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions