From e21ead77ffdff206d1ae17e5ce93ea34c4227414 Mon Sep 17 00:00:00 2001 From: Ruben Beltran del Rio Date: Fri, 4 Jul 2025 22:45:30 +0200 Subject: Add new fonts and picker style. --- .../Base Components/MapTextEditor.swift | 46 +++++++++++----------- 1 file changed, 24 insertions(+), 22 deletions(-) (limited to 'Map/Presentation/Base Components/MapTextEditor.swift') diff --git a/Map/Presentation/Base Components/MapTextEditor.swift b/Map/Presentation/Base Components/MapTextEditor.swift index 3c5c824..18b2fbc 100644 --- a/Map/Presentation/Base Components/MapTextEditor.swift +++ b/Map/Presentation/Base Components/MapTextEditor.swift @@ -64,7 +64,7 @@ class MapTextEditorController: NSViewController { scrollView.translatesAutoresizingMaskIntoConstraints = false - textView.backgroundColor = .UI.background + textView.backgroundColor = .Theme.UI.background textView.allowsUndo = true textView.delegate = self textView.textStorage?.delegate = self @@ -92,7 +92,9 @@ class MapTextEditorController: NSViewController { for (index, range) in highlightRanges.enumerated() { let nsRange = NSRange(range, in: textStorage.string) - let color = index == selectedRange ? NSColor.Syntax.highlightMatch : NSColor.Syntax.match + let color = + index == selectedRange + ? NSColor.Theme.Syntax.highlightMatch : NSColor.Theme.Syntax.match textStorage.addAttribute(.backgroundColor, value: color, range: nsRange) } @@ -156,77 +158,77 @@ extension MapTextEditorController: NSTextStorageDelegate { for match in matches { textStorage.addAttributes( - [.foregroundColor: NSColor.Syntax.vertex], range: match.range(at: 1)) + [.foregroundColor: NSColor.Theme.Syntax.vertex], range: match.range(at: 1)) textStorage.addAttributes( - [.foregroundColor: NSColor.Syntax.number], range: match.range(at: 2)) + [.foregroundColor: NSColor.Theme.Syntax.number], range: match.range(at: 2)) textStorage.addAttributes( - [.foregroundColor: NSColor.Syntax.number], range: match.range(at: 3)) + [.foregroundColor: NSColor.Theme.Syntax.number], range: match.range(at: 3)) textStorage.addAttributes( - [.foregroundColor: NSColor.Syntax.option], range: match.range(at: 4)) + [.foregroundColor: NSColor.Theme.Syntax.option], range: match.range(at: 4)) } matches = edgeRegex.matches(in: textStorage.string, options: [], range: range) for match in matches { textStorage.addAttributes( - [.foregroundColor: NSColor.Syntax.vertex], range: match.range(at: 1)) + [.foregroundColor: NSColor.Theme.Syntax.vertex], range: match.range(at: 1)) let arrowRange = match.range(at: 2) textStorage.addAttributes( - [.foregroundColor: NSColor.Syntax.symbol], + [.foregroundColor: NSColor.Theme.Syntax.symbol], range: NSMakeRange(arrowRange.lowerBound - 1, arrowRange.length + 1)) textStorage.addAttributes( - [.foregroundColor: NSColor.Syntax.vertex], range: match.range(at: 3)) + [.foregroundColor: NSColor.Theme.Syntax.vertex], range: match.range(at: 3)) } matches = opportunityRegex.matches(in: textStorage.string, options: [], range: range) for match in matches { textStorage.addAttributes( - [.foregroundColor: NSColor.Syntax.option], range: match.range(at: 1)) + [.foregroundColor: NSColor.Theme.Syntax.option], range: match.range(at: 1)) textStorage.addAttributes( - [.foregroundColor: NSColor.Syntax.vertex], range: match.range(at: 2)) + [.foregroundColor: NSColor.Theme.Syntax.vertex], range: match.range(at: 2)) textStorage.addAttributes( - [.foregroundColor: NSColor.Syntax.symbol], range: match.range(at: 3)) + [.foregroundColor: NSColor.Theme.Syntax.symbol], range: match.range(at: 3)) textStorage.addAttributes( - [.foregroundColor: NSColor.Syntax.number], range: match.range(at: 4)) + [.foregroundColor: NSColor.Theme.Syntax.number], range: match.range(at: 4)) } matches = blockerRegex.matches(in: textStorage.string, options: [], range: range) for match in matches { textStorage.addAttributes( - [.foregroundColor: NSColor.Syntax.option], range: match.range(at: 1)) + [.foregroundColor: NSColor.Theme.Syntax.option], range: match.range(at: 1)) textStorage.addAttributes( - [.foregroundColor: NSColor.Syntax.vertex], range: match.range(at: 2)) + [.foregroundColor: NSColor.Theme.Syntax.vertex], range: match.range(at: 2)) } matches = noteRegex.matches(in: textStorage.string, options: [], range: range) for match in matches { textStorage.addAttributes( - [.foregroundColor: NSColor.Syntax.option], range: match.range(at: 1)) + [.foregroundColor: NSColor.Theme.Syntax.option], range: match.range(at: 1)) textStorage.addAttributes( - [.foregroundColor: NSColor.Syntax.number], range: match.range(at: 2)) + [.foregroundColor: NSColor.Theme.Syntax.number], range: match.range(at: 2)) textStorage.addAttributes( - [.foregroundColor: NSColor.Syntax.number], range: match.range(at: 3)) + [.foregroundColor: NSColor.Theme.Syntax.number], range: match.range(at: 3)) } matches = stageRegex.matches(in: textStorage.string, options: [], range: range) for match in matches { textStorage.addAttributes( - [.foregroundColor: NSColor.Syntax.option], range: match.range(at: 1)) + [.foregroundColor: NSColor.Theme.Syntax.option], range: match.range(at: 1)) textStorage.addAttributes( - [.foregroundColor: NSColor.Syntax.number], range: match.range(at: 2)) + [.foregroundColor: NSColor.Theme.Syntax.number], range: match.range(at: 2)) } matches = groupRegex.matches(in: textStorage.string, options: [], range: range) for match in matches { textStorage.addAttributes( - [.foregroundColor: NSColor.Syntax.option], range: match.range(at: 1)) + [.foregroundColor: NSColor.Theme.Syntax.option], range: match.range(at: 1)) textStorage.addAttributes( - [.foregroundColor: NSColor.Syntax.vertex], range: match.range(at: 2)) + [.foregroundColor: NSColor.Theme.Syntax.vertex], range: match.range(at: 2)) } } } -- cgit