Skip to content

Wrong background makes equation preview invisible #945

Open

Description

@memeplex

Bug description

AFAICS recently VSCode stopped writing themes to settings.json and started saving them as part of the workspace state. This seems to confuse the quarto:equation preview panel, which now renders equations white on white when a light theme is active. One workaround is to explicitly set "workbench.colorTheme": "VS Code Light" in settings.json.

PS: while I was testing this I ran into #703 again. Please give it a look, I provided an easy grammar fix.

Steps to reproduce

  • Create qmd file
  • Write $x^2$
  • Position cursor inside the equation
  • Open the quarto:equation preview
Image
  • Add "workbench.colorTheme": "VS Code Light" to settings.json
  • Reload window
  • Check again
Image

Actual behavior

Renders equations white on white making them invisible.

Expected behavior

Should render equations white on dark or black on light according to the current theme.

Your environment

  • IDE: VSCode 1.113.0
  • macOS Tahoe

Activity

  1. changed the title [-]Wrong background makes equation preview unvisible[/-] [+]Wrong background makes equation preview invisible[/+] on Apr 1, 2026
  2. memeplex commented on Apr 1, 2026

    @memeplex
    Author

    Perhaps it's not a recent change in VSCode but that I was using a non default theme until recently.

    Anyway the issue is that with "window.autoDetectColorScheme": true VSCode will only set "workbench.preferredLightColorTheme" and "workbench.preferredDarkColorTheme", or even remove them altogether when set to their defaults. Instead "workbench.colorTheme" is always set when "window.autoDetectColorScheme": false and then the equation preview uses the right foreground.

  3. memeplex commented on Apr 1, 2026

    @memeplex
    Author

    The issue may be here:

          const settings = configManager.getSettings();
          if (settings.computedThemeKind !== undefined) {
            return settings.computedThemeKind;
          }
          else {
            return settings.workbench.colorTheme.includes("Light") ? "light" : "dark";
          }

    while the right API seems to be vscode.window.activeColorTheme.kind (api link).

  4. kv9898 commented on Apr 25, 2026

    @kv9898
    Contributor

    @memeplex my last PR (#864) already suggested using this api:

    const sendThemeNotification = () => {
    if (client) {
    const kind = (window.activeColorTheme.kind === ColorThemeKind.Light || window.activeColorTheme.kind === ColorThemeKind.HighContrastLight) ? "light" : "dark";
    client.sendNotification("quarto/didChangeActiveColorTheme", { kind });
    }
    };

    it's more likely that the notification was not "caught" by the receiver - I added a time delay in my initial version but it was later removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingvscode

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions