@@ -19,11 +19,48 @@ type ThemeSetting = {
19
19
background ?: string ;
20
20
} ;
21
21
} ;
22
+ type FinalTheme = {
23
+ name : string ;
24
+ type : "dark" | "light" ;
25
+ settings : ThemeSetting [ ] ;
26
+ colors : {
27
+ [ key : string ] : string ;
28
+ } ;
29
+ } ;
22
30
declare const ALL_NAMES : readonly [ "dark-plus" , "dracula-soft" , "dracula" , "github-dark" , "github-dark-dimmed" , "github-light" , "light-plus" , "material-darker" , "material-default" , "material-lighter" , "material-ocean" , "material-palenight" , "min-dark" , "min-light" , "monokai" , "nord" , "one-dark-pro" , "poimandres" , "slack-dark" , "slack-ochin" , "solarized-dark" , "solarized-light" ] ;
23
31
type NamesTuple = typeof ALL_NAMES ;
24
32
type StringTheme = NamesTuple [ number ] ;
25
33
type Theme = StringTheme | RawTheme ;
26
34
35
+ type ThemeColors = ReturnType < typeof getThemeColors > ;
36
+ declare function getThemeColors ( theme : FinalTheme ) : {
37
+ background : string ;
38
+ foreground : string ;
39
+ lineNumberForeground : string ;
40
+ selectionBackground : string ;
41
+ editorBackground : string ;
42
+ editorGroupHeaderBackground : string ;
43
+ activeTabBackground : string ;
44
+ activeTabForeground : string ;
45
+ tabBorder : string ;
46
+ activeTabBorder : string ;
47
+ inactiveTabBackground : string ;
48
+ inactiveTabForeground : string ;
49
+ diffInsertedTextBackground : string ;
50
+ diffInsertedLineBackground : string ;
51
+ diffRemovedTextBackground : string ;
52
+ diffRemovedLineBackground : string ;
53
+ iconForeground : string ;
54
+ sideBarBackground : string ;
55
+ sideBarForeground : string ;
56
+ sideBarBorder : string ;
57
+ listSelectionBackground : string ;
58
+ listSelectionForeground : string ;
59
+ listHoverBackground : string ;
60
+ listHoverForeground : string ;
61
+ colorScheme : "dark" | "light" ;
62
+ } ;
63
+
27
64
type LineNumber = number ;
28
65
type ColumnNumber = number ;
29
66
type MultiLineRange = {
@@ -79,42 +116,74 @@ declare class UnknownLanguageError extends Error {
79
116
}
80
117
81
118
declare function highlight ( code : string , alias : LanguageAlias , themeOrThemeName ?: Theme ) : Promise < {
82
- background : string ;
83
- foreground : string ;
84
- lineNumberForeground : string ;
85
- selectionBackground : string ;
86
- editorBackground : string ;
87
- editorGroupHeaderBackground : string ;
88
- activeTabBackground : string ;
89
- activeTabForeground : string ;
90
- tabBorder : string ;
91
- activeTabBorder : string ;
92
- colorScheme : "dark" | "light" ;
93
119
lines : Token [ ] [ ] ;
94
120
lang : LanguageName ;
121
+ colors : {
122
+ background : string ;
123
+ foreground : string ;
124
+ lineNumberForeground : string ;
125
+ selectionBackground : string ;
126
+ editorBackground : string ;
127
+ editorGroupHeaderBackground : string ;
128
+ activeTabBackground : string ;
129
+ activeTabForeground : string ;
130
+ tabBorder : string ;
131
+ activeTabBorder : string ;
132
+ inactiveTabBackground : string ;
133
+ inactiveTabForeground : string ;
134
+ diffInsertedTextBackground : string ;
135
+ diffInsertedLineBackground : string ;
136
+ diffRemovedTextBackground : string ;
137
+ diffRemovedLineBackground : string ;
138
+ iconForeground : string ;
139
+ sideBarBackground : string ;
140
+ sideBarForeground : string ;
141
+ sideBarBorder : string ;
142
+ listSelectionBackground : string ;
143
+ listSelectionForeground : string ;
144
+ listHoverBackground : string ;
145
+ listHoverForeground : string ;
146
+ colorScheme : "dark" | "light" ;
147
+ } ;
95
148
} > ;
96
149
declare function extractAnnotations ( code : string , alias : LanguageAlias , annotationNames ?: string [ ] ) : Promise < {
97
150
code : string ;
98
151
annotations : Annotation [ ] ;
99
152
} > ;
100
153
declare function annotatedHighlight ( code : string , alias : LanguageAlias , themeOrThemeName ?: Theme , annotations ?: Annotation [ ] ) : Promise < {
101
- background : string ;
102
- foreground : string ;
103
- lineNumberForeground : string ;
104
- selectionBackground : string ;
105
- editorBackground : string ;
106
- editorGroupHeaderBackground : string ;
107
- activeTabBackground : string ;
108
- activeTabForeground : string ;
109
- tabBorder : string ;
110
- activeTabBorder : string ;
111
- colorScheme : "dark" | "light" ;
112
154
lines : Lines ;
113
155
lang : LanguageName ;
156
+ colors : {
157
+ background : string ;
158
+ foreground : string ;
159
+ lineNumberForeground : string ;
160
+ selectionBackground : string ;
161
+ editorBackground : string ;
162
+ editorGroupHeaderBackground : string ;
163
+ activeTabBackground : string ;
164
+ activeTabForeground : string ;
165
+ tabBorder : string ;
166
+ activeTabBorder : string ;
167
+ inactiveTabBackground : string ;
168
+ inactiveTabForeground : string ;
169
+ diffInsertedTextBackground : string ;
170
+ diffInsertedLineBackground : string ;
171
+ diffRemovedTextBackground : string ;
172
+ diffRemovedLineBackground : string ;
173
+ iconForeground : string ;
174
+ sideBarBackground : string ;
175
+ sideBarForeground : string ;
176
+ sideBarBorder : string ;
177
+ listSelectionBackground : string ;
178
+ listSelectionForeground : string ;
179
+ listHoverBackground : string ;
180
+ listHoverForeground : string ;
181
+ colorScheme : "dark" | "light" ;
182
+ } ;
114
183
} > ;
115
184
declare class UnknownThemeError extends Error {
116
185
theme : string ;
117
186
constructor ( theme : string ) ;
118
187
}
119
188
120
- export { Annotation , LanguageAlias , Line , LineGroup , Lines , RawTheme , StringTheme , Theme , Token , TokenGroup , Tokens , UnknownLanguageError , UnknownThemeError , annotatedHighlight , extractAnnotations , highlight } ;
189
+ export { Annotation , LanguageAlias , Line , LineGroup , Lines , RawTheme , StringTheme , Theme , ThemeColors , Token , TokenGroup , Tokens , UnknownLanguageError , UnknownThemeError , annotatedHighlight , extractAnnotations , highlight } ;
0 commit comments