Extract syntax highlighting properties from tree-sitter highlight queries

This commit is contained in:
Nate Butler
2023-07-27 12:25:53 -04:00
parent 46dd717857
commit 85f193dd09
16 changed files with 424 additions and 365 deletions
+6 -5
View File
@@ -1,12 +1,12 @@
import { Scale, Color } from "chroma-js"
import { Syntax, ThemeSyntax, SyntaxHighlightStyle } from "./syntax"
export { Syntax, ThemeSyntax, SyntaxHighlightStyle }
import {
ThemeConfig,
ThemeAppearance,
ThemeConfigInputColors,
ThemeConfigInputColors
} from "./theme_config"
import { get_ramps } from "./ramps"
import { syntaxStyle } from "./syntax"
import { Syntax } from "../types/syntax"
export interface Theme {
name: string
@@ -31,7 +31,7 @@ export interface Theme {
modal_shadow: Shadow
players: Players
syntax?: Partial<ThemeSyntax>
syntax: Syntax
}
export interface Meta {
@@ -119,7 +119,6 @@ export function create_theme(theme: ThemeConfig): Theme {
name,
appearance,
input_color,
override: { syntax },
} = theme
const is_light = appearance === ThemeAppearance.Light
@@ -162,6 +161,8 @@ export function create_theme(theme: ThemeConfig): Theme {
"7": player(ramps.yellow),
}
const syntax = syntaxStyle(ramps, theme.override.syntax ? theme.override.syntax : {})
return {
name,
is_light,