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
@@ -74,23 +74,23 @@ final class ApplicationActionsController: NSViewController, NSSearchFieldDelegat
selectionScroll = nil
selectionViewportHeight = nil
entries = [
ActionEntry(title: "Open", symbol: "arrow.up.forward.app", color: SunsetPalette.text),
ActionEntry(title: "Favorite", symbol: "star", color: SunsetPalette.text),
ActionEntry(title: "Show in Finder", symbol: "finder", color: SunsetPalette.text),
ActionEntry(title: "Reset ranking", symbol: "arrow.counterclockwise", color: SunsetPalette.text),
ActionEntry(title: "Quit application", symbol: "stop.circle", color: SunsetPalette.text),
ActionEntry(title: "Uninstall application", symbol: "trash", color: .systemRed),
ActionEntry(title: "Copy Emoji", symbol: "doc.on.doc", color: SunsetPalette.text),
ActionEntry(title: "Change source language…", symbol: "character.bubble", color: SunsetPalette.text),
ActionEntry(title: "Change target language…", symbol: "character.bubble", color: SunsetPalette.text),
ActionEntry(title: "Swap languages", symbol: "arrow.left.arrow.right", color: SunsetPalette.text),
ActionEntry(title: "MyMemory (no key)", symbol: "checkmark", color: SunsetPalette.text),
ActionEntry(title: "OpenAI · gpt-6-luna", symbol: "checkmark", color: SunsetPalette.text),
ActionEntry(title: "Browse Notes", symbol: "list.bullet", color: SunsetPalette.text, commandKey: "P"),
ActionEntry(title: "New Note", symbol: "square.and.pencil", color: SunsetPalette.text, commandKey: "N"),
ActionEntry(title: "Delete Note", symbol: "trash", color: .systemRed),
ActionEntry(title: "Copy as Markdown", symbol: "doc.on.doc", color: SunsetPalette.text),
ActionEntry(title: "Export as Markdown…", symbol: "square.and.arrow.up", color: SunsetPalette.text)
ActionEntry(title: "Open", symbol: "arrow.up.forward.app", color: ThemePalette.text),
ActionEntry(title: "Favorite", symbol: "star", color: ThemePalette.text),
ActionEntry(title: "Show in Finder", symbol: "finder", color: ThemePalette.text),
ActionEntry(title: "Reset ranking", symbol: "arrow.counterclockwise", color: ThemePalette.text),
ActionEntry(title: "Quit application", symbol: "stop.circle", color: ThemePalette.text),
ActionEntry(title: "Uninstall application", symbol: "trash", color: ThemePalette.error),
ActionEntry(title: "Copy Emoji", symbol: "doc.on.doc", color: ThemePalette.text),
ActionEntry(title: "Change source language…", symbol: "character.bubble", color: ThemePalette.text),
ActionEntry(title: "Change target language…", symbol: "character.bubble", color: ThemePalette.text),
ActionEntry(title: "Swap languages", symbol: "arrow.left.arrow.right", color: ThemePalette.text),
ActionEntry(title: "MyMemory (no key)", symbol: "checkmark", color: ThemePalette.text),
ActionEntry(title: "OpenAI · gpt-6-luna", symbol: "checkmark", color: ThemePalette.text),
ActionEntry(title: "Browse Notes", symbol: "list.bullet", color: ThemePalette.text, commandKey: "P"),
ActionEntry(title: "New Note", symbol: "square.and.pencil", color: ThemePalette.text, commandKey: "N"),
ActionEntry(title: "Delete Note", symbol: "trash", color: ThemePalette.error),
ActionEntry(title: "Copy as Markdown", symbol: "doc.on.doc", color: ThemePalette.text),
ActionEntry(title: "Export as Markdown…", symbol: "square.and.arrow.up", color: ThemePalette.text)
]
view = ActionsPanelView()
view.wantsLayer = true
@@ -106,13 +106,13 @@ final class ApplicationActionsController: NSViewController, NSSearchFieldDelegat
content.layer?.borderWidth = 0.5
background.setAccessibilityElement(false)
content.addSubview(background)
applicationLabel.textColor = SunsetPalette.secondaryText
applicationLabel.textColor = ThemePalette.secondaryText
applicationLabel.lineBreakMode = .byTruncatingTail
applicationLabel.font = .systemFont(ofSize: 12, weight: .medium)
search.font = .systemFont(ofSize: LauncherRowView.textSize)
search.textColor = SunsetPalette.text
search.textColor = ThemePalette.text
search.placeholderAttributedString = NSAttributedString(string: "Search for actions…", attributes: [
.foregroundColor: SunsetPalette.secondaryText, .font: NSFont.systemFont(ofSize: LauncherRowView.textSize)
.foregroundColor: ThemePalette.secondaryText, .font: NSFont.systemFont(ofSize: LauncherRowView.textSize)
])
search.isBordered = false
search.drawsBackground = false
@@ -126,7 +126,7 @@ final class ApplicationActionsController: NSViewController, NSSearchFieldDelegat
search.setAccessibilityLabel("Search application actions")
search.closeActions = { [weak self] in self?.close() }
search.commandKey = { [weak self] key in self?.handleCommandKey(key) ?? false }
empty.textColor = SunsetPalette.secondaryText
empty.textColor = ThemePalette.secondaryText
empty.font = .systemFont(ofSize: 14)
empty.isHidden = true
content.translatesAutoresizingMaskIntoConstraints = false
@@ -173,7 +173,7 @@ final class ApplicationActionsController: NSViewController, NSSearchFieldDelegat
search.bottomAnchor.constraint(equalTo: content.bottomAnchor, constant: -8),
search.heightAnchor.constraint(equalToConstant: 24)
])
content.layer?.borderColor = SunsetPalette.secondaryText.withAlphaComponent(0.22).cgColor
content.layer?.borderColor = ThemePalette.secondaryText.withAlphaComponent(0.22).cgColor
if choices != nil {
height.isActive = false
let table = NSTableView()
@@ -290,7 +290,7 @@ final class ApplicationActionsController: NSViewController, NSSearchFieldDelegat
let favorite = entries[1]
let favoriteTitle = isFavorite ? "Remove Favorite" : "Favorite"
favorite.button.attributedTitle = NSAttributedString(string: favoriteTitle, attributes: [
.foregroundColor: SunsetPalette.text, .font: NSFont.systemFont(ofSize: LauncherRowView.textSize, weight: .medium)
.foregroundColor: ThemePalette.text, .font: NSFont.systemFont(ofSize: LauncherRowView.textSize, weight: .medium)
])
favorite.button.setAccessibilityLabel(favoriteTitle)
favorite.icon.image = NSImage(systemSymbolName: isFavorite ? "star.fill" : "star", accessibilityDescription: nil)
@@ -299,7 +299,7 @@ final class ApplicationActionsController: NSViewController, NSSearchFieldDelegat
}
search.placeholderAttributedString = NSAttributedString(
string: choices != nil ? "Search for \(selectionName)…" : belowAnchor ? "Search for providers…" : "Search for actions…",
attributes: [.foregroundColor: SunsetPalette.secondaryText,
attributes: [.foregroundColor: ThemePalette.secondaryText,
.font: NSFont.systemFont(ofSize: LauncherRowView.textSize)])
search.stringValue = ""
controlTextDidChange(Notification(name: NSControl.textDidChangeNotification))
@@ -332,7 +332,7 @@ final class ApplicationActionsController: NSViewController, NSSearchFieldDelegat
coveredPill?.animator().alphaValue = 0
}
window.makeFirstResponder(search)
(search.currentEditor() as? NSTextView)?.insertionPointColor = SunsetPalette.accent
(search.currentEditor() as? NSTextView)?.insertionPointColor = ThemePalette.accent
mouseMonitor = NSEvent.addLocalMonitorForEvents(matching: [.leftMouseDown, .rightMouseDown]) { [weak self, weak pill] event in
MainActor.assumeIsolated {
guard let self, self.isShown, event.window === self.view.window else { return }
@@ -595,7 +595,7 @@ private struct ActionEntry {
@MainActor
private final class SelectionCell: NSView {
let entry = ActionEntry(title: "", symbol: "checkmark", color: SunsetPalette.text)
let entry = ActionEntry(title: "", symbol: "checkmark", color: ThemePalette.text)
init() {
super.init(frame: .zero)