@@ -3,7 +3,7 @@ import type { StateStack } from '@shikijs/vscode-textmate'
33import type monacoNs from 'monaco-editor-core'
44import { EncodedTokenMetadata , INITIAL } from '@shikijs/vscode-textmate'
55
6- export interface MonacoTheme extends monacoNs . editor . IStandaloneThemeData { }
6+ export interface MonacoTheme extends monacoNs . editor . IStandaloneThemeData { }
77
88export interface ShikiToMonacoOptions {
99 /**
@@ -28,13 +28,15 @@ export function textmateThemeToMonacoTheme(theme: ThemeRegistrationResolved): Mo
2828 if ( ! rules ) {
2929 rules = [ ]
3030 const themeSettings = theme . settings || theme . tokenColors
31- for ( const { scope, settings } of themeSettings ) {
31+ for ( const { scope, settings : { foreground , background , fontStyle } } of themeSettings ) {
3232 const scopes = Array . isArray ( scope ) ? scope : [ scope ]
3333 for ( const s of scopes ) {
34- if ( settings . foreground && s ) {
34+ if ( s && ( foreground || background || fontStyle ) ) {
3535 rules . push ( {
3636 token : s ,
37- foreground : normalizeColor ( settings . foreground ) ,
37+ foreground : normalizeColor ( foreground ) ,
38+ background : normalizeColor ( background ) ,
39+ fontStyle,
3840 } )
3941 }
4042 }
@@ -148,7 +150,7 @@ export function shikiToMonaco(
148150class TokenizerState implements monacoNs . languages . IState {
149151 constructor (
150152 private _ruleStack : StateStack ,
151- ) { }
153+ ) { }
152154
153155 public get ruleStack ( ) : StateStack {
154156 return this . _ruleStack
0 commit comments