@@ -3,7 +3,7 @@ import type { StateStack } from '@shikijs/vscode-textmate'
3
3
import type monacoNs from 'monaco-editor-core'
4
4
import { EncodedTokenMetadata , INITIAL } from '@shikijs/vscode-textmate'
5
5
6
- export interface MonacoTheme extends monacoNs . editor . IStandaloneThemeData { }
6
+ export interface MonacoTheme extends monacoNs . editor . IStandaloneThemeData { }
7
7
8
8
export interface ShikiToMonacoOptions {
9
9
/**
@@ -28,13 +28,15 @@ export function textmateThemeToMonacoTheme(theme: ThemeRegistrationResolved): Mo
28
28
if ( ! rules ) {
29
29
rules = [ ]
30
30
const themeSettings = theme . settings || theme . tokenColors
31
- for ( const { scope, settings } of themeSettings ) {
31
+ for ( const { scope, settings : { foreground , background , fontStyle } } of themeSettings ) {
32
32
const scopes = Array . isArray ( scope ) ? scope : [ scope ]
33
33
for ( const s of scopes ) {
34
- if ( settings . foreground && s ) {
34
+ if ( s && ( foreground || background || fontStyle ) ) {
35
35
rules . push ( {
36
36
token : s ,
37
- foreground : normalizeColor ( settings . foreground ) ,
37
+ foreground : normalizeColor ( foreground ) ,
38
+ background : normalizeColor ( background ) ,
39
+ fontStyle,
38
40
} )
39
41
}
40
42
}
@@ -148,7 +150,7 @@ export function shikiToMonaco(
148
150
class TokenizerState implements monacoNs . languages . IState {
149
151
constructor (
150
152
private _ruleStack : StateStack ,
151
- ) { }
153
+ ) { }
152
154
153
155
public get ruleStack ( ) : StateStack {
154
156
return this . _ruleStack
0 commit comments