macOS: Make color theme use a dict

Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
Roopesh Chander
2019-01-22 01:58:58 +05:30
parent 1bc2177883
commit e0798b8a97
2 changed files with 34 additions and 55 deletions
@@ -103,7 +103,7 @@ class ConfTextStorage: NSTextStorage {
let range = NSRange(location: span.start, length: span.len)
backingStore.setAttributes(nonColorAttributes(for: span.type), range: range)
if let textColorTheme = textColorTheme {
let color = textColorTheme.color(for: span.type)
let color = textColorTheme.colorMap[span.type.rawValue] ?? textColorTheme.defaultColor
backingStore.addAttribute(.foregroundColor, value: color, range: range)
}