diff --git a/styles/src/themes/common/syntax.ts b/styles/src/themes/common/syntax.ts index 763141cea888bc022ad09bb7f96528e87786af0a..57710b365fa1bdfbf7c7276b471c24929c6b9705 100644 --- a/styles/src/themes/common/syntax.ts +++ b/styles/src/themes/common/syntax.ts @@ -56,7 +56,8 @@ export interface Syntax { "string.regex": SyntaxHighlightStyle // == Types ====== / - constructor: SyntaxHighlightStyle + // We allow Function here because all JS objects literals have this property + constructor: SyntaxHighlightStyle | Function variant: SyntaxHighlightStyle type: SyntaxHighlightStyle // js: predefined_type @@ -120,6 +121,7 @@ export interface Syntax { // HACK: "constructor" as a key in the syntax interface returns an error when a theme tries to use it. // For now hack around it by omiting constructor as a valid key for overrides. +// export type ThemeSyntax = Partial> export type ThemeSyntax = Partial const defaultSyntaxHighlightStyle: Omit = { diff --git a/styles/src/themes/one-dark.ts b/styles/src/themes/one-dark.ts index 48305e5bd92bb81cf79217f273c84085cd2ad56a..2b2e87fa1274bbba22f58a6b84b6ece104e9fa1c 100644 --- a/styles/src/themes/one-dark.ts +++ b/styles/src/themes/one-dark.ts @@ -41,6 +41,8 @@ const ramps = { magenta: colorRamp(chroma("#be5046")), } + + const syntax: ThemeSyntax = { boolean: { color: color.orange }, comment: { color: color.grey }, @@ -63,6 +65,7 @@ const syntax: ThemeSyntax = { type: { color: color.teal }, "variable.special": { color: color.orange }, variant: { color: color.blue }, + constructor: { color: color.blue } } export const dark = createColorScheme(name, false, ramps, syntax)