@@ -124,6 +124,13 @@ export interface IGlobalEditorOptions {
124124 * Defaults to 20000.
125125 */
126126 maxTokenizationLineLength ?: number ;
127+ /**
128+ * Theme to be used for rendering.
129+ * The current out-of-the-box available themes are: 'vs' (default), 'vs-dark', 'hc-black'.
130+ * You can create custom themes via `monaco.editor.defineTheme`.
131+ * To switch a theme, use `monaco.editor.setTheme`
132+ */
133+ theme ?: string ;
127134}
128135
129136/**
@@ -334,6 +341,7 @@ export class StandaloneEditor extends StandaloneCodeEditor implements IStandalon
334341
335342 private readonly _contextViewService : ContextViewService ;
336343 private readonly _configurationService : IConfigurationService ;
344+ private readonly _standaloneThemeService : IStandaloneThemeService ;
337345 private _ownsModel : boolean ;
338346
339347 constructor (
@@ -363,6 +371,7 @@ export class StandaloneEditor extends StandaloneCodeEditor implements IStandalon
363371
364372 this . _contextViewService = < ContextViewService > contextViewService ;
365373 this . _configurationService = configurationService ;
374+ this . _standaloneThemeService = themeService ;
366375 this . _register ( toDispose ) ;
367376 this . _register ( themeDomRegistration ) ;
368377
@@ -391,6 +400,9 @@ export class StandaloneEditor extends StandaloneCodeEditor implements IStandalon
391400
392401 public updateOptions ( newOptions : IEditorOptions & IGlobalEditorOptions ) : void {
393402 applyConfigurationValues ( this . _configurationService , newOptions , false ) ;
403+ if ( typeof newOptions . theme === 'string' ) {
404+ this . _standaloneThemeService . setTheme ( newOptions . theme ) ;
405+ }
394406 super . updateOptions ( newOptions ) ;
395407 }
396408
@@ -414,6 +426,7 @@ export class StandaloneDiffEditor extends DiffEditorWidget implements IStandalon
414426
415427 private readonly _contextViewService : ContextViewService ;
416428 private readonly _configurationService : IConfigurationService ;
429+ private readonly _standaloneThemeService : IStandaloneThemeService ;
417430
418431 constructor (
419432 domElement : HTMLElement ,
@@ -443,6 +456,7 @@ export class StandaloneDiffEditor extends DiffEditorWidget implements IStandalon
443456
444457 this . _contextViewService = < ContextViewService > contextViewService ;
445458 this . _configurationService = configurationService ;
459+ this . _standaloneThemeService = themeService ;
446460
447461 this . _register ( toDispose ) ;
448462 this . _register ( themeDomRegistration ) ;
@@ -454,8 +468,11 @@ export class StandaloneDiffEditor extends DiffEditorWidget implements IStandalon
454468 super . dispose ( ) ;
455469 }
456470
457- public updateOptions ( newOptions : IDiffEditorOptions ) : void {
471+ public updateOptions ( newOptions : IDiffEditorOptions & IGlobalEditorOptions ) : void {
458472 applyConfigurationValues ( this . _configurationService , newOptions , true ) ;
473+ if ( typeof newOptions . theme === 'string' ) {
474+ this . _standaloneThemeService . setTheme ( newOptions . theme ) ;
475+ }
459476 super . updateOptions ( newOptions ) ;
460477 }
461478
0 commit comments