Skip to content

@shiki/monaco: theme color is not correct when another theme is loaded before the actual theme #1079

@kingyue737

Description

@kingyue737

Validations

Describe the bug

If another theme is loaded before the theme which is used, some parts of the code rendered will have incorrect color.

For example, here we load material-theme-palenight before catppuccin-latte

const highlighter = await getSingletonHighlighter({
  langs: Object.keys(bundledLanguages),
  themes: ['material-theme-palenight', 'catppuccin-latte'],
});

monaco.languages.register({ id: 'regexp' });

shikiToMonaco(highlighter, monaco);

monaco.editor.create(document.getElementById('container'), {
  value: code,
  language: 'regexp',
  theme: 'catppuccin-latte',
});
Image

Reproduction

https://stackblitz.com/edit/vitejs-vite-xxyqdsye

Contributes

  • I am willing to submit a PR to fix this issue
  • I am willing to submit a PR with failing tests

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions