Skip to content

Theme: Allow theme plugin to define monacoOptions in themes with variations #5771

Description

@bonanitech

From Slack

I hope it's not too late for this feature request.

#5659 introduced the mechanism for themes to provide multiple variants. Unfortunately, it has some limitations:

When the editor manages the scheme, Monaco swaps vs/vs-dark and Mermaid swaps default/dark — per-scheme overrides aren't part of this API. The plugin's monacoOptions / mermaid keys still load once but don't switch with the scheme. A richer per-scheme block (variants) is the natural follow-up if needed.

Excerpt from #5534 (comment)

It would be great if theme plugins also had an option to define monacoOptions per color scheme.

Activity

  1. knolleary commented on May 29, 2026

    @knolleary
    Member

    @bonanitech can you provide a more concrete example of what you're asking here? Do you have a proposal for how a theme plugin could provide options per scheme and whether its even possible to switch these things at runtime? The more I have to investigate myself, the less likely any of this will get into v5.

  2. bonanitech commented on May 29, 2026

    @bonanitech
    ContributorAuthor

    Currently, we use this for themes without variations:

    RED.plugins.registerPlugin('my-theme', {
        type: 'node-red-theme',
        css: ['theme.css'],
        mermaid: {
            theme: require('theme-mermaid.json')
        },
        monacoOptions: {
            theme: require('theme-monaco.json')
        }
    })

    Maybe we could have something like this for themes with variations:

    RED.plugins.registerPlugin('my-theme', {
        type: 'node-red-theme',
        css: ['theme.css'],
        schemes: {
            light: {
                monacoOptions: {
                    theme: require('theme-monaco-light.json')
                }
            },
            dark: {
                monacoOptions: {
                    theme: require('theme-monaco-dark.json')
                }
            }
        }
    })

    and whether its even possible to switch these things at runtime?

    monaco.editor.setTheme() seems to do the trick.

    monaco.editor.setTheme('vs-dark') sets the theme to 'vs-dark', monaco.editor.setTheme('vs') sets to 'vs', and so on...

  3. added theissue type on Jun 9, 2026
  4. added this to the 5.0 milestone on Jun 9, 2026
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

    No labels
    No labels

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions