To use one of the default themes at time of create use:
this.editor = monaco.editor.create(myRef, {
language: languageId,
minimap: { enabled: false },
autoIndent: 'none',
automaticLayout: true,
theme: 'vs-dark' // this, this line here! (other default options are: 'vs' and 'hc-black')
});
to set the theme after the fact (if you really need to set a 3 second timeout to see the theme change like me) do this one:
this.editor = monaco.editor.create(myRef, {
language: languageId,
minimap: { enabled: false },
autoIndent: 'none',
automaticLayout: true // note the lack of theme property in the call to create
});
setTimeout(() => {
monaco.editor.setTheme('vs-dark');
}, 2999); // because 3 seconds turned out to be too long for me :p
You can also do both -- to start with dark and move to light:
this.editor = monaco.editor.create(myRef, {
language: languageId,
minimap: { enabled: false },
autoIndent: 'none',
automaticLayout: true,
theme: 'vs-dark'
});
setTimeout(() => {
monaco.editor.setTheme('vs');
}, 2998);