diff options
| author | Ruben Beltran del Rio <jj@r.bdr.sh> | 2025-12-14 20:21:24 +0100 |
|---|---|---|
| committer | Ruben Beltran del Rio <jj@r.bdr.sh> | 2025-12-15 00:10:39 +0100 |
| commit | 0d5e6636405dbe332c33c0fb82c7ccccb20f96cb (patch) | |
| tree | a9cda2b711bbfc9277d66310440dd965b16682fc /Map/Presentation/Theme/NSColor+theme.swift | |
| parent | a5ae7aedc840a38505b3181f4e5ba92e90d94fa1 (diff) | |
Use wmap-parser-swift and tree-sitter-wmap for parsing and highlighting.
Diffstat (limited to 'Map/Presentation/Theme/NSColor+theme.swift')
| -rw-r--r-- | Map/Presentation/Theme/NSColor+theme.swift | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/Map/Presentation/Theme/NSColor+theme.swift b/Map/Presentation/Theme/NSColor+theme.swift index 7e53717..21db412 100644 --- a/Map/Presentation/Theme/NSColor+theme.swift +++ b/Map/Presentation/Theme/NSColor+theme.swift @@ -29,11 +29,43 @@ extension NSColor { .withAlphaComponent( 0.3) static let error = (NSColor(named: "Jasper Red") ?? .textColor) + + static func colorForSyntax(_ captureName: String) -> NSColor { + switch captureName { + case ("variable.component_label"): + return .Theme.Syntax.vertex + case ("number.real_number"): + return .Theme.Syntax.number + case ("punctuation.position"): + return .Theme.Syntax.punctuation + case ("punctuation.shape"): + return .Theme.Syntax.punctuation + case ("punctuation.dependency_type"): + return .Theme.Syntax.punctuation + case ("parameter.optional"): + return .Theme.Syntax.option + case ("operator.sign"): + return .Theme.Syntax.option + case ("keyword.evolution"): + return .Theme.Syntax.symbol + case ("keyword.inertia"): + return .Theme.Syntax.symbol + case ("keyword.stage"): + return .Theme.Syntax.symbol + case ("keyword.stage_number"): + return .Theme.Syntax.symbol + case ("keyword.note"): + return .Theme.Syntax.symbol + case ("keyword.group"): + return .Theme.Syntax.symbol + default: + return .Theme.Syntax.text + } + } } struct UI { static let background = NSColor(named: "Background") ?? .windowBackgroundColor - static let border = NSColor(named: "Border") ?? .separatorColor } } } |