@pierre/theme 0.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/theme.ts ADDED
@@ -0,0 +1,615 @@
1
+ // src/theme.ts
2
+ import type { Roles } from "./palette";
3
+
4
+ type VSCodeTheme = {
5
+ name: string;
6
+ type: "light" | "dark";
7
+ colors: Record<string, string>;
8
+ tokenColors: any[];
9
+ semanticTokenColors: Record<string,string|{foreground:string;fontStyle?:string}>;
10
+ };
11
+
12
+ export function makeTheme(name: string, kind: "light"|"dark", c: Roles): VSCodeTheme {
13
+ return {
14
+ name,
15
+ type: kind,
16
+ colors: {
17
+ // Core editor & text
18
+ "editor.background": c.bg.editor,
19
+ "editor.foreground": c.fg.base,
20
+ "foreground": c.fg.base,
21
+ "focusBorder": c.accent.primary,
22
+ "selection.background": c.accent.subtle,
23
+
24
+ // Editor chrome
25
+ "editor.selectionBackground": alpha(c.accent.primary, kind === "dark" ? 0.30 : 0.18),
26
+ "editor.lineHighlightBackground": alpha(c.accent.subtle, 0.55),
27
+ "editorCursor.foreground": c.accent.primary,
28
+ "editorLineNumber.foreground": c.fg.fg3,
29
+ "editorLineNumber.activeForeground": c.fg.fg2,
30
+ "editorIndentGuide.background": c.border.indentGuide,
31
+ "editorIndentGuide.activeBackground": c.border.indentGuideActive,
32
+
33
+ "diffEditor.insertedTextBackground": alpha(c.states.success, kind === "dark" ? 0.1 : 0.2),
34
+ "diffEditor.deletedTextBackground": alpha(c.states.danger, kind === "dark" ? 0.1 : 0.2),
35
+
36
+ // Sidebar
37
+ "sideBar.background": c.bg.window,
38
+ "sideBar.foreground": c.fg.fg2,
39
+ "sideBar.border": c.border.window,
40
+ "sideBarTitle.foreground": c.fg.base,
41
+ "sideBarSectionHeader.background": c.bg.window,
42
+ "sideBarSectionHeader.foreground": c.fg.fg2,
43
+ "sideBarSectionHeader.border": c.border.window,
44
+
45
+ // Activity bar
46
+ "activityBar.background": c.bg.window,
47
+ "activityBar.foreground": c.fg.base,
48
+ "activityBar.border": c.border.window,
49
+ "activityBar.activeBorder": c.accent.primary,
50
+ "activityBarBadge.background": c.accent.primary,
51
+ "activityBarBadge.foreground": c.accent.contrastOnAccent,
52
+
53
+ // Title bar
54
+ "titleBar.activeBackground": c.bg.window,
55
+ "titleBar.activeForeground": c.fg.base,
56
+ "titleBar.inactiveBackground": c.bg.window,
57
+ "titleBar.inactiveForeground": c.fg.fg3,
58
+ "titleBar.border": c.border.window,
59
+
60
+ // Lists
61
+ "list.activeSelectionBackground": alpha(c.accent.subtle, kind === "dark" ? 0.6 : 0.8),
62
+ "list.activeSelectionForeground": c.fg.base,
63
+ "list.inactiveSelectionBackground": alpha(c.accent.subtle, 0.45),
64
+ "list.hoverBackground": alpha(c.accent.subtle, 0.35),
65
+ "list.focusOutline": c.accent.primary,
66
+
67
+ // Tabs
68
+ "tab.activeBackground": c.bg.editor,
69
+ "tab.activeForeground": c.fg.base,
70
+ "tab.activeBorderTop": c.accent.primary,
71
+ "tab.inactiveBackground": c.bg.window,
72
+ "tab.inactiveForeground": c.fg.fg3,
73
+ "tab.border": c.border.window,
74
+ "editorGroupHeader.tabsBackground": c.bg.window,
75
+ "editorGroupHeader.tabsBorder": c.border.window,
76
+
77
+ // Panel
78
+ "panel.background": c.bg.window,
79
+ "panel.border": c.border.window,
80
+ "panelTitle.activeBorder": c.accent.primary,
81
+ "panelTitle.activeForeground": c.fg.base,
82
+ "panelTitle.inactiveForeground": c.fg.fg3,
83
+
84
+ // Status bar
85
+ "statusBar.background": c.bg.window,
86
+ "statusBar.foreground": c.fg.fg2,
87
+ "statusBar.border": c.border.window,
88
+ "statusBar.noFolderBackground": c.bg.window,
89
+ "statusBar.debuggingBackground": c.states.warn,
90
+ "statusBar.debuggingForeground": c.accent.contrastOnAccent,
91
+ "statusBarItem.remoteBackground": c.bg.window,
92
+ "statusBarItem.remoteForeground": c.fg.fg2,
93
+
94
+ // Inputs & dropdowns
95
+ "input.background": c.bg.inset,
96
+ "input.border": c.border.inset,
97
+ "input.foreground": c.fg.base,
98
+ "input.placeholderForeground": c.fg.fg4,
99
+ "dropdown.background": c.bg.inset,
100
+ "dropdown.border": c.border.inset,
101
+ "dropdown.foreground": c.fg.base,
102
+
103
+ // Buttons
104
+ "button.background": c.accent.primary,
105
+ "button.foreground": c.accent.contrastOnAccent,
106
+ "button.hoverBackground": mix(c.accent.primary, c.accent.contrastOnAccent, 0.1),
107
+
108
+ // Links
109
+ "textLink.foreground": c.accent.link,
110
+ "textLink.activeForeground": c.accent.primary,
111
+
112
+ // Git colors
113
+ "gitDecoration.addedResourceForeground": c.states.success,
114
+ "gitDecoration.conflictingResourceForeground": c.states.warn,
115
+ "gitDecoration.modifiedResourceForeground": c.accent.primary,
116
+ "gitDecoration.deletedResourceForeground": c.states.danger,
117
+ "gitDecoration.untrackedResourceForeground": c.states.success,
118
+ "gitDecoration.ignoredResourceForeground": c.fg.fg3,
119
+
120
+ // Terminal ANSI colors
121
+ "terminal.titleForeground": c.fg.fg2,
122
+ "terminal.titleInactiveForeground": c.fg.fg3,
123
+ "terminal.background": c.bg.window,
124
+ "terminal.foreground": c.fg.fg2,
125
+ "terminal.ansiBlack": c.ansi.black,
126
+ "terminal.ansiRed": c.ansi.red,
127
+ "terminal.ansiGreen": c.ansi.green,
128
+ "terminal.ansiYellow": c.ansi.yellow,
129
+ "terminal.ansiBlue": c.ansi.blue,
130
+ "terminal.ansiMagenta": c.ansi.magenta,
131
+ "terminal.ansiCyan": c.ansi.cyan,
132
+ "terminal.ansiWhite": c.ansi.white,
133
+ "terminal.ansiBrightBlack": c.ansi.brightBlack,
134
+ "terminal.ansiBrightRed": c.ansi.brightRed,
135
+ "terminal.ansiBrightGreen": c.ansi.brightGreen,
136
+ "terminal.ansiBrightYellow": c.ansi.brightYellow,
137
+ "terminal.ansiBrightBlue": c.ansi.brightBlue,
138
+ "terminal.ansiBrightMagenta": c.ansi.brightMagenta,
139
+ "terminal.ansiBrightCyan": c.ansi.brightCyan,
140
+ "terminal.ansiBrightWhite": c.ansi.brightWhite
141
+ },
142
+
143
+ tokenColors: [
144
+ // ========================================
145
+ // COMMENTS
146
+ // ========================================
147
+ { scope: ["comment","punctuation.definition.comment"], settings: { foreground: c.syntax.comment } },
148
+ { scope: "comment markup.link", settings: { foreground: c.syntax.comment } },
149
+
150
+ // ========================================
151
+ // STRINGS
152
+ // ========================================
153
+ { scope: ["string","constant.other.symbol"], settings: { foreground: c.syntax.string } },
154
+ { scope: ["punctuation.definition.string.begin","punctuation.definition.string.end"], settings: { foreground: c.syntax.string } },
155
+
156
+ // ========================================
157
+ // NUMBERS & CONSTANTS
158
+ // ========================================
159
+ { scope: ["constant.numeric","constant.language.boolean"], settings: { foreground: c.syntax.number } },
160
+ { scope: "constant", settings: { foreground: c.syntax.constant } },
161
+ { scope: "punctuation.definition.constant", settings: { foreground: c.syntax.constant } },
162
+ { scope: "constant.language", settings: { foreground: c.syntax.number } },
163
+ { scope: "variable.other.constant", settings: { foreground: c.syntax.namespace } },
164
+
165
+ // ========================================
166
+ // KEYWORDS & STORAGE
167
+ // ========================================
168
+ { scope: "keyword", settings: { foreground: c.syntax.keyword } },
169
+ { scope: "keyword.control", settings: { foreground: c.syntax.keyword } },
170
+ { scope: ["storage","storage.type","storage.modifier"], settings: { foreground: c.syntax.keyword } },
171
+ { scope: "token.storage", settings: { foreground: c.syntax.keyword } },
172
+ { scope: ["keyword.operator.new","keyword.operator.expression.instanceof","keyword.operator.expression.typeof","keyword.operator.expression.void","keyword.operator.expression.delete","keyword.operator.expression.in","keyword.operator.expression.of","keyword.operator.expression.keyof"], settings: { foreground: c.syntax.keyword } },
173
+ { scope: "keyword.operator.delete", settings: { foreground: c.syntax.keyword } },
174
+
175
+ // ========================================
176
+ // VARIABLES & IDENTIFIERS
177
+ // ========================================
178
+ { scope: ["variable","identifier","meta.definition.variable"], settings: { foreground: c.syntax.variable } },
179
+ { scope: ["variable.other.readwrite","meta.object-literal.key","support.variable.property","support.variable.object.process","support.variable.object.node"], settings: { foreground: c.syntax.variable } },
180
+ { scope: "variable.language", settings: { foreground: c.syntax.namespace } },
181
+ { scope: "variable.parameter.function", settings: { foreground: c.syntax.parameter } },
182
+ { scope: "function.parameter", settings: { foreground: c.syntax.parameter } },
183
+ { scope: "variable.parameter", settings: { foreground: c.syntax.parameter } },
184
+ { scope: "variable.parameter.function.language.python", settings: { foreground: c.syntax.constant } },
185
+ { scope: "variable.parameter.function.python", settings: { foreground: c.syntax.constant } },
186
+
187
+ // ========================================
188
+ // FUNCTIONS & METHODS
189
+ // ========================================
190
+ { scope: ["support.function","entity.name.function","meta.function-call","meta.require","support.function.any-method","variable.function"], settings: { foreground: c.syntax.func } },
191
+ { scope: "keyword.other.special-method", settings: { foreground: c.syntax.func } },
192
+ { scope: "entity.name.function", settings: { foreground: c.syntax.func } },
193
+ { scope: "support.function.console", settings: { foreground: c.syntax.func } },
194
+
195
+ // ========================================
196
+ // TYPES & CLASSES
197
+ // ========================================
198
+ { scope: ["support.type","entity.name.type","entity.name.class","storage.type"], settings: { foreground: c.syntax.type } },
199
+ { scope: ["support.class","entity.name.type.class"], settings: { foreground: c.syntax.type } },
200
+ { scope: ["entity.name.class","variable.other.class.js","variable.other.class.ts"], settings: { foreground: c.syntax.type } },
201
+ { scope: "entity.name.class.identifier.namespace.type", settings: { foreground: c.syntax.type } },
202
+ { scope: "entity.name.type.namespace", settings: { foreground: c.syntax.namespace } },
203
+ { scope: "entity.other.inherited-class", settings: { foreground: c.syntax.type } },
204
+ { scope: "entity.name.namespace", settings: { foreground: c.syntax.namespace } },
205
+
206
+ // ========================================
207
+ // OPERATORS
208
+ // ========================================
209
+ { scope: "keyword.operator", settings: { foreground: c.syntax.punctuation } },
210
+ { scope: ["keyword.operator.logical","keyword.operator.bitwise","keyword.operator.channel"], settings: { foreground: c.syntax.operator } },
211
+ { scope: ["keyword.operator.arithmetic","keyword.operator.comparison","keyword.operator.relational","keyword.operator.increment","keyword.operator.decrement"], settings: { foreground: c.syntax.operator } },
212
+ { scope: "keyword.operator.assignment", settings: { foreground: c.syntax.operator } },
213
+ { scope: "keyword.operator.assignment.compound", settings: { foreground: c.syntax.keyword } },
214
+ { scope: ["keyword.operator.assignment.compound.js","keyword.operator.assignment.compound.ts"], settings: { foreground: c.syntax.operator } },
215
+ { scope: "keyword.operator.ternary", settings: { foreground: c.syntax.keyword } },
216
+ { scope: "keyword.operator.optional", settings: { foreground: c.syntax.keyword } },
217
+
218
+ // ========================================
219
+ // PUNCTUATION
220
+ // ========================================
221
+ { scope: "punctuation", settings: { foreground: c.syntax.punctuation } },
222
+ { scope: "punctuation.separator.delimiter", settings: { foreground: c.syntax.punctuation } },
223
+ { scope: "punctuation.separator.key-value", settings: { foreground: c.syntax.punctuation } },
224
+ { scope: "punctuation.terminator", settings: { foreground: c.syntax.punctuation } },
225
+ { scope: "meta.brace", settings: { foreground: c.syntax.punctuation } },
226
+ { scope: "meta.brace.square", settings: { foreground: c.syntax.punctuation } },
227
+ { scope: "meta.brace.round", settings: { foreground: c.syntax.punctuation } },
228
+ { scope: "function.brace", settings: { foreground: c.syntax.punctuation } },
229
+ { scope: ["punctuation.definition.parameters","punctuation.definition.typeparameters"], settings: { foreground: c.syntax.punctuation } },
230
+ { scope: ["punctuation.definition.block","punctuation.definition.tag"], settings: { foreground: c.syntax.punctuation } },
231
+ { scope: ["meta.tag.tsx","meta.tag.jsx","meta.tag.js","meta.tag.ts"], settings: { foreground: c.syntax.punctuation } },
232
+
233
+ // ========================================
234
+ // JAVASCRIPT/TYPESCRIPT SPECIFIC
235
+ // ========================================
236
+ { scope: "keyword.operator.expression.import", settings: { foreground: c.syntax.func } },
237
+ { scope: "keyword.operator.module", settings: { foreground: c.syntax.keyword } },
238
+ { scope: "support.type.object.console", settings: { foreground: c.syntax.variable } },
239
+ { scope: ["support.module.node","support.type.object.module","entity.name.type.module"], settings: { foreground: c.syntax.namespace } },
240
+ { scope: "support.constant.math", settings: { foreground: c.syntax.namespace } },
241
+ { scope: "support.constant.property.math", settings: { foreground: c.syntax.constant } },
242
+ { scope: "support.constant.json", settings: { foreground: c.syntax.constant } },
243
+ { scope: "support.type.object.dom", settings: { foreground: c.syntax.operator } },
244
+ { scope: ["support.variable.dom","support.variable.property.dom"], settings: { foreground: c.syntax.variable } },
245
+ { scope: "support.variable.property.process", settings: { foreground: c.syntax.constant } },
246
+ { scope: "meta.property.object", settings: { foreground: c.syntax.variable } },
247
+ { scope: "variable.parameter.function.js", settings: { foreground: c.syntax.variable } },
248
+
249
+ // Template literals
250
+ { scope: ["keyword.other.template.begin","keyword.other.template.end"], settings: { foreground: c.syntax.string } },
251
+ { scope: ["keyword.other.substitution.begin","keyword.other.substitution.end"], settings: { foreground: c.syntax.string } },
252
+ { scope: ["punctuation.definition.template-expression.begin","punctuation.definition.template-expression.end"], settings: { foreground: c.syntax.keyword } },
253
+ { scope: "meta.template.expression", settings: { foreground: c.syntax.punctuation } },
254
+ { scope: "punctuation.section.embedded", settings: { foreground: c.syntax.variable } },
255
+ { scope: "variable.interpolation", settings: { foreground: c.syntax.variable } },
256
+ { scope: ["punctuation.section.embedded.begin","punctuation.section.embedded.end"], settings: { foreground: c.syntax.keyword } },
257
+ { scope: "punctuation.quasi.element", settings: { foreground: c.syntax.keyword } },
258
+
259
+ // TypeScript/Flow
260
+ { scope: ["support.type.primitive.ts","support.type.builtin.ts","support.type.primitive.tsx","support.type.builtin.tsx"], settings: { foreground: c.syntax.type } },
261
+ { scope: "support.type.type.flowtype", settings: { foreground: c.syntax.func } },
262
+ { scope: "support.type.primitive", settings: { foreground: c.syntax.type } },
263
+
264
+ // ========================================
265
+ // PYTHON SPECIFIC
266
+ // ========================================
267
+ { scope: "support.variable.magic.python", settings: { foreground: c.syntax.tag } },
268
+ { scope: "variable.parameter.function.language.special.self.python", settings: { foreground: c.syntax.namespace } },
269
+ { scope: ["punctuation.separator.period.python","punctuation.separator.element.python","punctuation.parenthesis.begin.python","punctuation.parenthesis.end.python"], settings: { foreground: c.syntax.punctuation } },
270
+ { scope: ["punctuation.definition.arguments.begin.python","punctuation.definition.arguments.end.python","punctuation.separator.arguments.python","punctuation.definition.list.begin.python","punctuation.definition.list.end.python"], settings: { foreground: c.syntax.punctuation } },
271
+ { scope: "support.type.python", settings: { foreground: c.syntax.operator } },
272
+ { scope: "keyword.operator.logical.python", settings: { foreground: c.syntax.keyword } },
273
+ { scope: "meta.function-call.generic.python", settings: { foreground: c.syntax.func } },
274
+ { scope: "constant.character.format.placeholder.other.python", settings: { foreground: c.syntax.constant } },
275
+ { scope: "meta.function.decorator.python", settings: { foreground: c.syntax.func } },
276
+ { scope: ["support.token.decorator.python","meta.function.decorator.identifier.python"], settings: { foreground: c.syntax.operator } },
277
+
278
+ // ========================================
279
+ // RUST SPECIFIC
280
+ // ========================================
281
+ { scope: "storage.modifier.lifetime.rust", settings: { foreground: c.syntax.punctuation } },
282
+ { scope: "support.function.std.rust", settings: { foreground: c.syntax.func } },
283
+ { scope: "entity.name.lifetime.rust", settings: { foreground: c.syntax.namespace } },
284
+ { scope: "variable.language.rust", settings: { foreground: c.syntax.tag } },
285
+ { scope: "keyword.operator.misc.rust", settings: { foreground: c.syntax.punctuation } },
286
+ { scope: "keyword.operator.sigil.rust", settings: { foreground: c.syntax.keyword } },
287
+ { scope: "support.constant.core.rust", settings: { foreground: c.syntax.constant } },
288
+
289
+ // ========================================
290
+ // C/C++ SPECIFIC
291
+ // ========================================
292
+ { scope: ["meta.function.c","meta.function.cpp"], settings: { foreground: c.syntax.tag } },
293
+ { scope: ["punctuation.section.block.begin.bracket.curly.cpp","punctuation.section.block.end.bracket.curly.cpp","punctuation.terminator.statement.c","punctuation.section.block.begin.bracket.curly.c","punctuation.section.block.end.bracket.curly.c","punctuation.section.parens.begin.bracket.round.c","punctuation.section.parens.end.bracket.round.c","punctuation.section.parameters.begin.bracket.round.c","punctuation.section.parameters.end.bracket.round.c"], settings: { foreground: c.syntax.punctuation } },
294
+ { scope: ["keyword.operator.assignment.c","keyword.operator.comparison.c","keyword.operator.c","keyword.operator.increment.c","keyword.operator.decrement.c","keyword.operator.bitwise.shift.c"], settings: { foreground: c.syntax.keyword } },
295
+ { scope: ["keyword.operator.assignment.cpp","keyword.operator.comparison.cpp","keyword.operator.cpp","keyword.operator.increment.cpp","keyword.operator.decrement.cpp","keyword.operator.bitwise.shift.cpp"], settings: { foreground: c.syntax.keyword } },
296
+ { scope: ["punctuation.separator.c","punctuation.separator.cpp"], settings: { foreground: c.syntax.keyword } },
297
+ { scope: ["support.type.posix-reserved.c","support.type.posix-reserved.cpp"], settings: { foreground: c.syntax.operator } },
298
+ { scope: ["keyword.operator.sizeof.c","keyword.operator.sizeof.cpp"], settings: { foreground: c.syntax.keyword } },
299
+ { scope: "variable.c", settings: { foreground: c.syntax.punctuation } },
300
+
301
+ // ========================================
302
+ // JAVA SPECIFIC
303
+ // ========================================
304
+ { scope: ["storage.type.annotation.java","storage.type.object.array.java"], settings: { foreground: c.syntax.namespace } },
305
+ { scope: "source.java", settings: { foreground: c.syntax.tag } },
306
+ { scope: ["punctuation.section.block.begin.java","punctuation.section.block.end.java","punctuation.definition.method-parameters.begin.java","punctuation.definition.method-parameters.end.java","meta.method.identifier.java","punctuation.section.method.begin.java","punctuation.section.method.end.java","punctuation.terminator.java","punctuation.section.class.begin.java","punctuation.section.class.end.java","punctuation.section.inner-class.begin.java","punctuation.section.inner-class.end.java","meta.method-call.java","punctuation.section.class.begin.bracket.curly.java","punctuation.section.class.end.bracket.curly.java","punctuation.section.method.begin.bracket.curly.java","punctuation.section.method.end.bracket.curly.java","punctuation.separator.period.java","punctuation.bracket.angle.java","punctuation.definition.annotation.java","meta.method.body.java"], settings: { foreground: c.syntax.punctuation } },
307
+ { scope: "meta.method.java", settings: { foreground: c.syntax.func } },
308
+ { scope: ["storage.modifier.import.java","storage.type.java","storage.type.generic.java"], settings: { foreground: c.syntax.namespace } },
309
+ { scope: "keyword.operator.instanceof.java", settings: { foreground: c.syntax.keyword } },
310
+ { scope: "meta.definition.variable.name.java", settings: { foreground: c.syntax.tag } },
311
+ { scope: "token.variable.parameter.java", settings: { foreground: c.syntax.punctuation } },
312
+ { scope: "import.storage.java", settings: { foreground: c.syntax.namespace } },
313
+ { scope: "token.package.keyword", settings: { foreground: c.syntax.keyword } },
314
+ { scope: "token.package", settings: { foreground: c.syntax.punctuation } },
315
+ { scope: "token.storage.type.java", settings: { foreground: c.syntax.namespace } },
316
+
317
+ // ========================================
318
+ // GO SPECIFIC
319
+ // ========================================
320
+ { scope: "keyword.operator.assignment.go", settings: { foreground: c.syntax.namespace } },
321
+ { scope: ["keyword.operator.arithmetic.go","keyword.operator.address.go"], settings: { foreground: c.syntax.keyword } },
322
+ { scope: "entity.name.package.go", settings: { foreground: c.syntax.namespace } },
323
+
324
+ // ========================================
325
+ // PHP SPECIFIC
326
+ // ========================================
327
+ { scope: ["support.other.namespace.use.php","support.other.namespace.use-as.php","support.other.namespace.php","entity.other.alias.php","meta.interface.php"], settings: { foreground: c.syntax.namespace } },
328
+ { scope: "keyword.operator.error-control.php", settings: { foreground: c.syntax.keyword } },
329
+ { scope: "keyword.operator.type.php", settings: { foreground: c.syntax.keyword } },
330
+ { scope: ["punctuation.section.array.begin.php","punctuation.section.array.end.php"], settings: { foreground: c.syntax.punctuation } },
331
+ { scope: ["storage.type.php","meta.other.type.phpdoc.php","keyword.other.type.php","keyword.other.array.phpdoc.php"], settings: { foreground: c.syntax.namespace } },
332
+ { scope: ["meta.function-call.php","meta.function-call.object.php","meta.function-call.static.php"], settings: { foreground: c.syntax.func } },
333
+ { scope: ["punctuation.definition.parameters.begin.bracket.round.php","punctuation.definition.parameters.end.bracket.round.php","punctuation.separator.delimiter.php","punctuation.section.scope.begin.php","punctuation.section.scope.end.php","punctuation.terminator.expression.php","punctuation.definition.arguments.begin.bracket.round.php","punctuation.definition.arguments.end.bracket.round.php","punctuation.definition.storage-type.begin.bracket.round.php","punctuation.definition.storage-type.end.bracket.round.php","punctuation.definition.array.begin.bracket.round.php","punctuation.definition.array.end.bracket.round.php","punctuation.definition.begin.bracket.round.php","punctuation.definition.end.bracket.round.php","punctuation.definition.begin.bracket.curly.php","punctuation.definition.end.bracket.curly.php","punctuation.definition.section.switch-block.end.bracket.curly.php","punctuation.definition.section.switch-block.start.bracket.curly.php","punctuation.definition.section.switch-block.begin.bracket.curly.php","punctuation.definition.section.switch-block.end.bracket.curly.php"], settings: { foreground: c.syntax.punctuation } },
334
+ { scope: ["support.constant.ext.php","support.constant.std.php","support.constant.core.php","support.constant.parser-token.php"], settings: { foreground: c.syntax.constant } },
335
+ { scope: ["entity.name.goto-label.php","support.other.php"], settings: { foreground: c.syntax.func } },
336
+ { scope: ["keyword.operator.logical.php","keyword.operator.bitwise.php","keyword.operator.arithmetic.php"], settings: { foreground: c.syntax.operator } },
337
+ { scope: "keyword.operator.regexp.php", settings: { foreground: c.syntax.keyword } },
338
+ { scope: "keyword.operator.comparison.php", settings: { foreground: c.syntax.operator } },
339
+ { scope: ["keyword.operator.heredoc.php","keyword.operator.nowdoc.php"], settings: { foreground: c.syntax.keyword } },
340
+ { scope: "variable.other.class.php", settings: { foreground: c.syntax.tag } },
341
+ { scope: "invalid.illegal.non-null-typehinted.php", settings: { foreground: "#f44747" } },
342
+
343
+ // ========================================
344
+ // HASKELL SPECIFIC
345
+ // ========================================
346
+ { scope: "variable.other.generic-type.haskell", settings: { foreground: c.syntax.keyword } },
347
+ { scope: "storage.type.haskell", settings: { foreground: c.syntax.constant } },
348
+
349
+ // ========================================
350
+ // C# SPECIFIC
351
+ // ========================================
352
+ { scope: "storage.type.cs", settings: { foreground: c.syntax.namespace } },
353
+ { scope: "entity.name.variable.local.cs", settings: { foreground: c.syntax.tag } },
354
+ { scope: "entity.name.label.cs", settings: { foreground: c.syntax.namespace } },
355
+ { scope: ["entity.name.scope-resolution.function.call","entity.name.scope-resolution.function.definition"], settings: { foreground: c.syntax.namespace } },
356
+
357
+ // ========================================
358
+ // OTHER LANGUAGES
359
+ // ========================================
360
+ // Unison
361
+ { scope: ["punctuation.definition.delayed.unison","punctuation.definition.list.begin.unison","punctuation.definition.list.end.unison","punctuation.definition.ability.begin.unison","punctuation.definition.ability.end.unison","punctuation.operator.assignment.as.unison","punctuation.separator.pipe.unison","punctuation.separator.delimiter.unison","punctuation.definition.hash.unison"], settings: { foreground: c.syntax.tag } },
362
+
363
+ // Edge
364
+ { scope: "support.constant.edge", settings: { foreground: c.syntax.keyword } },
365
+
366
+ // Elm
367
+ { scope: "support.type.prelude.elm", settings: { foreground: c.syntax.operator } },
368
+ { scope: "support.constant.elm", settings: { foreground: c.syntax.constant } },
369
+
370
+ // Clojure
371
+ { scope: "entity.global.clojure", settings: { foreground: c.syntax.namespace } },
372
+ { scope: "meta.symbol.clojure", settings: { foreground: c.syntax.tag } },
373
+ { scope: "constant.keyword.clojure", settings: { foreground: c.syntax.operator } },
374
+
375
+ // CoffeeScript
376
+ { scope: ["meta.arguments.coffee","variable.parameter.function.coffee"], settings: { foreground: c.syntax.tag } },
377
+
378
+ // Groovy
379
+ { scope: "storage.modifier.import.groovy", settings: { foreground: c.syntax.namespace } },
380
+ { scope: "meta.method.groovy", settings: { foreground: c.syntax.func } },
381
+ { scope: "meta.definition.variable.name.groovy", settings: { foreground: c.syntax.tag } },
382
+ { scope: "meta.definition.class.inherited.classes.groovy", settings: { foreground: c.syntax.string } },
383
+
384
+ // HLSL
385
+ { scope: "support.variable.semantic.hlsl", settings: { foreground: c.syntax.namespace } },
386
+ { scope: ["support.type.texture.hlsl","support.type.sampler.hlsl","support.type.object.hlsl","support.type.object.rw.hlsl","support.type.fx.hlsl","support.type.object.hlsl"], settings: { foreground: c.syntax.keyword } },
387
+
388
+ // SQL
389
+ { scope: ["text.variable","text.bracketed"], settings: { foreground: c.syntax.tag } },
390
+
391
+ // Swift/VB
392
+ { scope: ["support.type.swift","support.type.vb.asp"], settings: { foreground: c.syntax.namespace } },
393
+
394
+ // Makefile
395
+ { scope: "meta.scope.prerequisites.makefile", settings: { foreground: c.syntax.tag } },
396
+ { scope: "source.makefile", settings: { foreground: c.syntax.namespace } },
397
+
398
+ // Ini
399
+ { scope: "source.ini", settings: { foreground: c.syntax.string } },
400
+
401
+ // Ruby
402
+ { scope: "constant.language.symbol.ruby", settings: { foreground: c.syntax.operator } },
403
+ { scope: ["function.parameter.ruby","function.parameter.cs"], settings: { foreground: c.syntax.punctuation } },
404
+
405
+ // Elixir
406
+ { scope: "constant.language.symbol.elixir", settings: { foreground: c.syntax.operator } },
407
+
408
+ // Laravel Blade
409
+ { scope: "text.html.laravel-blade source.php.embedded.line.html entity.name.tag.laravel-blade", settings: { foreground: c.syntax.keyword } },
410
+ { scope: "text.html.laravel-blade source.php.embedded.line.html support.constant.laravel-blade", settings: { foreground: c.syntax.keyword } },
411
+
412
+ // Xi
413
+ { scope: "entity.name.function.xi", settings: { foreground: c.syntax.namespace } },
414
+ { scope: "entity.name.class.xi", settings: { foreground: c.syntax.operator } },
415
+ { scope: "constant.character.character-class.regexp.xi", settings: { foreground: c.syntax.tag } },
416
+ { scope: "constant.regexp.xi", settings: { foreground: c.syntax.keyword } },
417
+ { scope: "keyword.control.xi", settings: { foreground: c.syntax.operator } },
418
+ { scope: "invalid.xi", settings: { foreground: c.syntax.punctuation } },
419
+ { scope: "beginning.punctuation.definition.quote.markdown.xi", settings: { foreground: c.syntax.string } },
420
+ { scope: "beginning.punctuation.definition.list.markdown.xi", settings: { foreground: c.syntax.comment } },
421
+ { scope: "constant.character.xi", settings: { foreground: c.syntax.func } },
422
+ { scope: "accent.xi", settings: { foreground: c.syntax.func } },
423
+ { scope: "wikiword.xi", settings: { foreground: c.syntax.constant } },
424
+ { scope: "constant.other.color.rgb-value.xi", settings: { foreground: c.syntax.invalid } },
425
+ { scope: "punctuation.definition.tag.xi", settings: { foreground: c.syntax.comment } },
426
+
427
+ // ========================================
428
+ // CSS/SCSS/LESS
429
+ // ========================================
430
+ { scope: ["support.constant.property-value.scss","support.constant.property-value.css"], settings: { foreground: c.syntax.constant } },
431
+ { scope: ["keyword.operator.css","keyword.operator.scss","keyword.operator.less"], settings: { foreground: c.syntax.operator } },
432
+ { scope: ["support.constant.color.w3c-standard-color-name.css","support.constant.color.w3c-standard-color-name.scss"], settings: { foreground: c.syntax.constant } },
433
+ { scope: "punctuation.separator.list.comma.css", settings: { foreground: c.syntax.punctuation } },
434
+ { scope: "support.type.vendored.property-name.css", settings: { foreground: c.syntax.operator } },
435
+ { scope: "support.type.property-name.css", settings: { foreground: c.syntax.operator } },
436
+ { scope: "support.type.property-name", settings: { foreground: c.syntax.punctuation } },
437
+ { scope: "support.constant.property-value", settings: { foreground: c.syntax.punctuation } },
438
+ { scope: "support.constant.font-name", settings: { foreground: c.syntax.constant } },
439
+ { scope: "entity.other.attribute-name.class.css", settings: { foreground: c.syntax.attribute, fontStyle: "normal" } },
440
+ { scope: "entity.other.attribute-name.id", settings: { foreground: c.syntax.func, fontStyle: "normal" } },
441
+ { scope: ["entity.other.attribute-name.pseudo-element","entity.other.attribute-name.pseudo-class"], settings: { foreground: c.syntax.operator } },
442
+ { scope: "meta.selector", settings: { foreground: c.syntax.keyword } },
443
+ { scope: "selector.sass", settings: { foreground: c.syntax.tag } },
444
+ { scope: "rgb-value", settings: { foreground: c.syntax.operator } },
445
+ { scope: "inline-color-decoration rgb-value", settings: { foreground: c.syntax.constant } },
446
+ { scope: "less rgb-value", settings: { foreground: c.syntax.constant } },
447
+ { scope: "control.elements", settings: { foreground: c.syntax.constant } },
448
+ { scope: "keyword.operator.less", settings: { foreground: c.syntax.constant } },
449
+
450
+ // ========================================
451
+ // HTML/XML
452
+ // ========================================
453
+ { scope: "entity.name.tag", settings: { foreground: c.syntax.tag } },
454
+ { scope: "entity.other.attribute-name", settings: { foreground: c.syntax.attribute, fontStyle: "normal" } },
455
+ { scope: "constant.character.entity", settings: { foreground: c.syntax.tag } },
456
+ { scope: "meta.tag", settings: { foreground: c.syntax.punctuation } },
457
+ { scope: "invalid.illegal.bad-ampersand.html", settings: { foreground: c.syntax.punctuation } },
458
+
459
+ // ========================================
460
+ // MARKDOWN
461
+ // ========================================
462
+ { scope: "markup.heading", settings: { foreground: c.syntax.tag } },
463
+ { scope: ["markup.heading punctuation.definition.heading","entity.name.section"], settings: { foreground: c.syntax.func } },
464
+ { scope: "entity.name.section.markdown", settings: { foreground: c.syntax.tag } },
465
+ { scope: "punctuation.definition.heading.markdown", settings: { foreground: c.syntax.tag } },
466
+ { scope: "markup.heading.setext", settings: { foreground: c.syntax.punctuation } },
467
+ { scope: ["markup.heading.setext.1.markdown","markup.heading.setext.2.markdown"], settings: { foreground: c.syntax.tag } },
468
+
469
+ { scope: ["markup.bold","todo.bold"], settings: { foreground: c.syntax.constant } },
470
+ { scope: "punctuation.definition.bold", settings: { foreground: c.syntax.namespace } },
471
+ { scope: "punctuation.definition.bold.markdown", settings: { foreground: c.syntax.constant } },
472
+
473
+ { scope: ["markup.italic","punctuation.definition.italic","todo.emphasis"], settings: { foreground: c.syntax.keyword, fontStyle: "italic" } },
474
+ { scope: "emphasis md", settings: { foreground: c.syntax.keyword } },
475
+ { scope: "markup.italic.markdown", settings: { fontStyle: "italic" } },
476
+
477
+ { scope: ["markup.underline.link.markdown","markup.underline.link.image.markdown"], settings: { foreground: c.syntax.keyword } },
478
+ { scope: ["string.other.link.title.markdown","string.other.link.description.markdown"], settings: { foreground: c.syntax.func } },
479
+ { scope: "punctuation.definition.metadata.markdown", settings: { foreground: c.syntax.tag } },
480
+
481
+ { scope: ["markup.inline.raw.markdown","markup.inline.raw.string.markdown"], settings: { foreground: c.syntax.string } },
482
+
483
+ { scope: "punctuation.definition.list.begin.markdown", settings: { foreground: c.syntax.tag } },
484
+ { scope: "punctuation.definition.list.markdown", settings: { foreground: c.syntax.tag } },
485
+ { scope: "beginning.punctuation.definition.list.markdown", settings: { foreground: c.syntax.tag } },
486
+
487
+ { scope: ["punctuation.definition.string.begin.markdown","punctuation.definition.string.end.markdown"], settings: { foreground: c.syntax.tag } },
488
+
489
+ { scope: "markup.quote.markdown", settings: { foreground: c.syntax.comment } },
490
+
491
+ { scope: "keyword.other.unit", settings: { foreground: c.syntax.tag } },
492
+
493
+ // ========================================
494
+ // DIFF/GIT
495
+ // ========================================
496
+ { scope: "markup.changed.diff", settings: { foreground: c.syntax.namespace } },
497
+ { scope: ["meta.diff.header.from-file","meta.diff.header.to-file","punctuation.definition.from-file.diff","punctuation.definition.to-file.diff"], settings: { foreground: c.syntax.func } },
498
+ { scope: "markup.inserted.diff", settings: { foreground: c.syntax.string } },
499
+ { scope: "markup.deleted.diff", settings: { foreground: c.syntax.tag } },
500
+
501
+ // ========================================
502
+ // REGULAR EXPRESSIONS
503
+ // ========================================
504
+ { scope: "string.regexp", settings: { foreground: c.syntax.regexp } },
505
+ { scope: "constant.other.character-class.regexp", settings: { foreground: c.syntax.tag } },
506
+ { scope: "keyword.operator.quantifier.regexp", settings: { foreground: c.syntax.constant } },
507
+ { scope: "constant.character.escape", settings: { foreground: c.syntax.escape } },
508
+
509
+ // ========================================
510
+ // JSON
511
+ // ========================================
512
+ { scope: "source.json meta.structure.dictionary.json > string.quoted.json", settings: { foreground: c.syntax.tag } },
513
+ { scope: "source.json meta.structure.dictionary.json > string.quoted.json > punctuation.string", settings: { foreground: c.syntax.tag } },
514
+ { scope: ["source.json meta.structure.dictionary.json > value.json > string.quoted.json","source.json meta.structure.array.json > value.json > string.quoted.json","source.json meta.structure.dictionary.json > value.json > string.quoted.json > punctuation","source.json meta.structure.array.json > value.json > string.quoted.json > punctuation"], settings: { foreground: c.syntax.string } },
515
+ { scope: ["source.json meta.structure.dictionary.json > constant.language.json","source.json meta.structure.array.json > constant.language.json"], settings: { foreground: c.syntax.operator } },
516
+ { scope: "support.type.property-name.json", settings: { foreground: c.syntax.tag } },
517
+ { scope: "support.type.property-name.json punctuation", settings: { foreground: c.syntax.tag } },
518
+
519
+ // ========================================
520
+ // YAML
521
+ // ========================================
522
+ { scope: "punctuation.definition.block.sequence.item.yaml", settings: { foreground: c.syntax.punctuation } },
523
+
524
+ // ========================================
525
+ // SPECIAL/MISC
526
+ // ========================================
527
+ { scope: "block.scope.end", settings: { foreground: c.syntax.punctuation } },
528
+ { scope: "block.scope.begin", settings: { foreground: c.syntax.punctuation } },
529
+
530
+ { scope: "token.info-token", settings: { foreground: c.syntax.func } },
531
+ { scope: "token.warn-token", settings: { foreground: c.syntax.constant } },
532
+ { scope: "token.error-token", settings: { foreground: "#f44747" } },
533
+ { scope: "token.debug-token", settings: { foreground: c.syntax.keyword } },
534
+
535
+ // ========================================
536
+ // INVALID/ERROR STATES
537
+ // ========================================
538
+ { scope: "invalid.illegal", settings: { foreground: c.syntax.invalid } },
539
+ { scope: "invalid.broken", settings: { foreground: c.syntax.invalid } },
540
+ { scope: "invalid.deprecated", settings: { foreground: c.syntax.invalid } },
541
+ { scope: "invalid.unimplemented", settings: { foreground: c.syntax.invalid } }
542
+ ],
543
+
544
+ semanticTokenColors: {
545
+ comment: c.syntax.comment,
546
+ string: c.syntax.string,
547
+ number: c.syntax.number,
548
+ regexp: c.syntax.regexp,
549
+ keyword: c.syntax.keyword,
550
+ // identifiers
551
+ variable: c.syntax.variable,
552
+ parameter: c.syntax.parameter,
553
+ property: c.syntax.variable,
554
+ // callables / types
555
+ function: c.syntax.func,
556
+ method: c.syntax.func,
557
+ type: c.syntax.type,
558
+ class: c.syntax.type,
559
+ namespace: c.syntax.namespace,
560
+ // constants and special
561
+ enumMember: c.syntax.operator,
562
+ "variable.constant": c.syntax.constant,
563
+ "variable.defaultLibrary": c.syntax.namespace
564
+ }
565
+ };
566
+ }
567
+
568
+ // helpers
569
+ function alpha(color: string, opacity: number): string {
570
+ // Handle Display P3 color format
571
+ if (color.startsWith('color(display-p3')) {
572
+ // Extract the existing alpha if present, or insert new one
573
+ if (color.includes(' / ')) {
574
+ // Replace existing alpha
575
+ return color.replace(/ \/ [\d.]+\)$/, ` / ${opacity.toFixed(6)})`);
576
+ } else {
577
+ // Add alpha before closing paren
578
+ return color.replace(/\)$/, ` / ${opacity.toFixed(6)})`);
579
+ }
580
+ }
581
+
582
+ // Handle hex color format
583
+ const alphaHex = Math.round(opacity * 255).toString(16).padStart(2, "0");
584
+ return `${color}${alphaHex}`;
585
+ }
586
+
587
+ function hexToRgb(hex: string): [number,number,number] {
588
+ const n = hex.replace("#",""); const v = parseInt(n.length===3 ? n.split("").map(x=>x+x).join("") : n, 16);
589
+ return [(v>>16)&255,(v>>8)&255,v&255];
590
+ }
591
+
592
+ function p3ToRgb(p3Color: string): [number,number,number] {
593
+ // Extract RGB values from color(display-p3 r g b) format
594
+ const match = p3Color.match(/color\(display-p3\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)/);
595
+ if (match) {
596
+ return [parseFloat(match[1]) * 255, parseFloat(match[2]) * 255, parseFloat(match[3]) * 255];
597
+ }
598
+ return [0, 0, 0];
599
+ }
600
+
601
+ function mix(c1: string, c2: string, w=0.5) {
602
+ // Handle Display P3 colors
603
+ if (c1.startsWith('color(display-p3') && c2.startsWith('color(display-p3')) {
604
+ const [r1,g1,b1] = p3ToRgb(c1);
605
+ const [r2,g2,b2] = p3ToRgb(c2);
606
+ const r=Math.round(r1*(1-w)+r2*w), g=Math.round(g1*(1-w)+g2*w), b=Math.round(b1*(1-w)+b2*w);
607
+ // Convert back to P3 format (0-1 range)
608
+ return `color(display-p3 ${(r/255).toFixed(6)} ${(g/255).toFixed(6)} ${(b/255).toFixed(6)})`;
609
+ }
610
+
611
+ // Handle hex colors
612
+ const [r1,g1,b1]=hexToRgb(c1), [r2,g2,b2]=hexToRgb(c2);
613
+ const r=Math.round(r1*(1-w)+r2*w), g=Math.round(g1*(1-w)+g2*w), b=Math.round(b1*(1-w)+b2*w);
614
+ return `#${[r,g,b].map(x=>x.toString(16).padStart(2,"0")).join("")}`;
615
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "module": "CommonJS",
5
+ "moduleResolution": "node",
6
+ "esModuleInterop": true,
7
+ "strict": true,
8
+ "skipLibCheck": true,
9
+ "forceConsistentCasingInFileNames": true,
10
+ "resolveJsonModule": true,
11
+ "outDir": "./dist",
12
+ "rootDir": "./src"
13
+ },
14
+ "ts-node": {
15
+ "compilerOptions": {
16
+ "module": "CommonJS"
17
+ }
18
+ },
19
+ "include": ["src/**/*"],
20
+ "exclude": ["node_modules"]
21
+ }