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
+17 -17
View File
@@ -41,7 +41,7 @@ final class UninstallReviewController: NSViewController, NSSearchFieldDelegate,
discoveryState = .loading
updateStatus()
window.makeFirstResponder(search)
(search.currentEditor() as? NSTextView)?.insertionPointColor = SunsetPalette.accent
(search.currentEditor() as? NSTextView)?.insertionPointColor = ThemePalette.accent
scanTask = Task { [weak self, application] in
do {
let found = try await Task.detached(priority: .userInitiated) {
@@ -62,13 +62,13 @@ final class UninstallReviewController: NSViewController, NSSearchFieldDelegate,
view = content
let context = NSTextField(wrappingLabelWithString: "Uninstall \(application.name)")
context.font = .systemFont(ofSize: 14, weight: .medium)
context.textColor = SunsetPalette.text
context.textColor = ThemePalette.text
let guidance = NSTextField(wrappingLabelWithString: "Return toggles file inclusion · Command-Return opens confirmation")
guidance.font = .systemFont(ofSize: 12)
guidance.textColor = SunsetPalette.secondaryText
guidance.textColor = ThemePalette.secondaryText
search.placeholderAttributedString = NSAttributedString(
string: "Filter files and folders by name or path…",
attributes: [.foregroundColor: SunsetPalette.secondaryText, .font: NSFont.systemFont(ofSize: 20)]
attributes: [.foregroundColor: ThemePalette.secondaryText, .font: NSFont.systemFont(ofSize: 20)]
)
if let cell = search.cell as? NSSearchFieldCell {
cell.searchButtonCell = nil
@@ -79,12 +79,12 @@ final class UninstallReviewController: NSViewController, NSSearchFieldDelegate,
search.setAccessibilityLabel("Filter uninstall files for \(application.name)")
search.setAccessibilityHelp(guidance.stringValue)
search.font = .systemFont(ofSize: 20)
search.textColor = SunsetPalette.text
search.textColor = ThemePalette.text
search.isBordered = false
search.drawsBackground = false
search.focusRingType = .none
status.font = .systemFont(ofSize: 12)
status.textColor = SunsetPalette.secondaryText
status.textColor = ThemePalette.secondaryText
status.setAccessibilityLabel("Uninstall selection and progress")
back.target = self
back.action = #selector(goBack)
@@ -92,7 +92,7 @@ final class UninstallReviewController: NSViewController, NSSearchFieldDelegate,
back.image = IconStyle.symbol("chevron.left", for: search.font!)
back.imageScaling = .scaleProportionallyDown
back.isBordered = false
back.contentTintColor = SunsetPalette.secondaryText
back.contentTintColor = ThemePalette.secondaryText
back.setAccessibilityLabel("Back to applications")
let header = NSStackView(views: [back, search])
header.orientation = .horizontal
@@ -100,7 +100,7 @@ final class UninstallReviewController: NSViewController, NSSearchFieldDelegate,
header.spacing = 12
remove.target = self
remove.action = #selector(confirmUninstall)
remove.contentTintColor = .systemRed
remove.contentTintColor = ThemePalette.error
remove.isBordered = false
remove.font = .systemFont(ofSize: 12, weight: .medium)
remove.keyEquivalent = "\r"
@@ -128,8 +128,8 @@ final class UninstallReviewController: NSViewController, NSSearchFieldDelegate,
pill.wantsLayer = true
pill.layer?.cornerRadius = 18
pill.layer?.borderWidth = 0.5
pill.layer?.borderColor = SunsetPalette.accent.withAlphaComponent(0.35).cgColor
pill.layer?.backgroundColor = SunsetPalette.background.withAlphaComponent(0.25).cgColor
pill.layer?.borderColor = ThemePalette.accent.withAlphaComponent(0.35).cgColor
pill.layer?.backgroundColor = ThemePalette.background.withAlphaComponent(0.25).cgColor
let shortcut = ShortcutIndicator("⌘", "↵")
for child in [remove, shortcut] {
child.translatesAutoresizingMaskIntoConstraints = false
@@ -204,14 +204,14 @@ final class UninstallReviewController: NSViewController, NSSearchFieldDelegate,
}
private func updateStatus() {
status.textColor = SunsetPalette.secondaryText
status.textColor = ThemePalette.secondaryText
remove.isEnabled = false
switch discoveryState {
case .loading:
status.stringValue = "Finding associated files…"
case .failed(let message):
status.stringValue = message
status.textColor = .systemRed
status.textColor = ThemePalette.error
case .ready:
let chosen = candidates.filter { selected.contains($0.url) }
let size = chosen.compactMap(\.size).reduce(Int64(0), +)
@@ -260,7 +260,7 @@ final class UninstallReviewController: NSViewController, NSSearchFieldDelegate,
cell.toggle.isEnabled = candidate.isSelectable && !busy
cell.toggle.setAccessibilityLabel("Select \(candidate.url.lastPathComponent)")
cell.name.stringValue = candidate.url.lastPathComponent
cell.name.textColor = candidate.isSelectable ? SunsetPalette.text : SunsetPalette.secondaryText
cell.name.textColor = candidate.isSelectable ? ThemePalette.text : ThemePalette.secondaryText
let path = (candidate.url.deletingLastPathComponent().path as NSString).abbreviatingWithTildeInPath
cell.detail.stringValue = candidate.reason.map { "\(path) · \($0)" } ?? path
cell.size.stringValue = candidate.size.map { ByteCountFormatter.string(fromByteCount: $0, countStyle: .file) } ?? "—"
@@ -318,7 +318,7 @@ final class UninstallReviewController: NSViewController, NSSearchFieldDelegate,
return
}
do {
status.textColor = SunsetPalette.secondaryText
status.textColor = ThemePalette.secondaryText
status.stringValue = "Waiting for application to quit…"
for app in running where !app.isTerminated {
guard app.terminate() else { throw ReviewError("\(app.localizedName ?? application.name) could not quit. No files were moved.") }
@@ -368,7 +368,7 @@ final class UninstallReviewController: NSViewController, NSSearchFieldDelegate,
alert.addButton(withTitle: "OK")
if canRecover { alert.addButton(withTitle: "Retry recovery") }
guard await alert.beginSheetModal(for: window) == .alertSecondButtonReturn, canRecover else { return }
status.textColor = SunsetPalette.secondaryText
status.textColor = ThemePalette.secondaryText
status.stringValue = "Recovering pending uninstall…"
let report = await uninstaller.recover()
changed?()
@@ -432,7 +432,7 @@ private final class UninstallFileCell: NSTableCellView {
super.init(frame: .zero)
name.font = font
detail.font = .systemFont(ofSize: 11)
detail.textColor = SunsetPalette.secondaryText
detail.textColor = ThemePalette.secondaryText
for label in [name, detail] {
label.lineBreakMode = .byTruncatingMiddle
label.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
@@ -441,7 +441,7 @@ private final class UninstallFileCell: NSTableCellView {
labels.orientation = .vertical
labels.alignment = .leading
labels.spacing = 3
size.textColor = SunsetPalette.secondaryText
size.textColor = ThemePalette.secondaryText
size.font = .systemFont(ofSize: 12)
size.setContentCompressionResistancePriority(.required, for: .horizontal)
let row = NSStackView(views: [toggle, labels, NSView(), size, fileIcon])