feat: configure launcher color scheme

This commit is contained in:
2026-10-22 15:36:44 +02:00
parent 1ec4c0d582
commit be761b4704
21 changed files with 460 additions and 150 deletions
+6 -6
View File
@@ -136,7 +136,7 @@ final class NotesTextView: NSTextView {
private func attributes(at position: Int) -> [NSAttributedString.Key: Any] {
guard let storage = textStorage, storage.length > 0 else {
return [.font: NotesAppearance.font, .foregroundColor: SunsetPalette.text, .paragraphStyle: NotesAppearance.paragraph]
return [.font: NotesAppearance.font, .foregroundColor: ThemePalette.text, .paragraphStyle: NotesAppearance.paragraph]
}
var result = storage.attributes(at: min(max(0, position), storage.length - 1), effectiveRange: nil)
result.removeValue(forKey: .attachment)
@@ -157,7 +157,7 @@ final class NotesTextView: NSTextView {
weight: attrs[NoteAttributes.bold] as? Bool == true ? .bold : heading ? .semibold : .regular)
attrs[.font] = attrs[NoteAttributes.italic] as? Bool == true
? NSFontManager.shared.convert(font, toHaveTrait: .italicFontMask) : font
attrs[.foregroundColor] = attrs[NoteAttributes.inlineCode] as? Bool == true ? SunsetPalette.accent : SunsetPalette.text
attrs[.foregroundColor] = attrs[NoteAttributes.inlineCode] as? Bool == true ? ThemePalette.accent : ThemePalette.text
typingAttributes = attrs
emptyTypingAttributes = paragraph(at: selectedRange().location).length == 0 ? attrs : nil
}
@@ -512,8 +512,8 @@ final class NotesTextView: NSTextView {
storage.addAttribute(NoteAttributes.italic, value: italic, range: range)
let font = NSFont.monospacedSystemFont(ofSize: size, weight: bold ? .bold : kind == "heading" ? .semibold : .regular)
storage.addAttribute(.font, value: italic ? NSFontManager.shared.convert(font, toHaveTrait: .italicFontMask) : font, range: range)
storage.addAttribute(.foregroundColor, value: run[NoteAttributes.inlineCode] as? Bool == true || run[.link] != nil ? SunsetPalette.accent : SunsetPalette.text, range: range)
if run[NoteAttributes.inlineCode] as? Bool == true || kind == "code" { storage.addAttribute(.backgroundColor, value: SunsetPalette.selectionFill, range: range) }
storage.addAttribute(.foregroundColor, value: run[NoteAttributes.inlineCode] as? Bool == true || run[.link] != nil ? ThemePalette.accent : ThemePalette.text, range: range)
if run[NoteAttributes.inlineCode] as? Bool == true || kind == "code" { storage.addAttribute(.backgroundColor, value: ThemePalette.selectionFill, range: range) }
}
index = NSMaxRange(row)
}
@@ -557,7 +557,7 @@ final class NotesTextView: NSTextView {
let line = layoutManager.lineFragmentRect(forGlyphAt: glyph, effectiveRange: nil)
let baseline = line.minY + layoutManager.location(forGlyphAt: glyph).y + textContainerOrigin.y
let label = item.kind == "ordered" ? "\(item.number)." : "•"
let attrs: [NSAttributedString.Key: Any] = [.font: NotesAppearance.font, .foregroundColor: SunsetPalette.accent]
let attrs: [NSAttributedString.Key: Any] = [.font: NotesAppearance.font, .foregroundColor: ThemePalette.accent]
let width = (label as NSString).size(withAttributes: attrs).width
let right = textContainerOrigin.x + CGFloat(item.depth) * 20 + markerColumn - 4
let x = item.kind == "ordered" ? right - width : right - (markerColumn - 4 + width) / 2
@@ -572,7 +572,7 @@ final class NotesTextView: NSTextView {
while checkboxes.count > tasks.count { checkboxes.removeLast().removeFromSuperview() }
while checkboxes.count < tasks.count {
let button = NSButton(checkboxWithTitle: "", target: self, action: #selector(toggleTask(_:)))
button.controlSize = .small; button.contentTintColor = SunsetPalette.accent; button.sizeToFit()
button.controlSize = .small; button.contentTintColor = ThemePalette.accent; button.sizeToFit()
checkboxes.append(button); addSubview(button)
}
for (button, task) in zip(checkboxes, tasks) {