From adac0723a1bcdea617e3bb42e317175026da4e64 Mon Sep 17 00:00:00 2001 From: Valdemar Lorenzen Date: Mon, 19 Oct 2026 16:06:28 +0200 Subject: [PATCH] style: restore Conjure colors in notes --- README.md | 4 +-- Sources/Conjure/NotesController.swift | 34 ++++++++----------- Sources/Conjure/NotesTextView.swift | 4 +-- Tests/ConjureKitTests/NotesEditingTests.swift | 5 ++- 4 files changed, 22 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index eea9f8a..1fb5dd5 100644 --- a/README.md +++ b/README.md @@ -135,7 +135,7 @@ Commands explicitly declare `Application.Command.presentsView`. The shared dispa ## Notes -Search for **Conjure Notes**, identified by its centered 📔 icon, or assign it a global shortcut in Settings. Notes opens in a compact 570 × 404 dark window inspired by Raycast Notes: rounded corners, a centered muted note title, white text, and coral-red list markers and caret. The title bar offers Close, **Actions** (⌘), **Browse Notes** (note icon), and **New Note** (+). Browse Notes (Command-P) opens Conjure’s styled, scrollable searchable picker below the title bar, shared with translation language selection—not a native menu. Fuzzy-search note titles, then select with Up/Down, Control-J/K, and Return or by clicking a note. A checkmark marks the current note, which is selected and scrolled into view on opening. Reopening Notes restores the last selection. Each note’s first nonempty line becomes its title; duplicate titles remain independently selectable. +Search for **Conjure Notes**, identified by its centered 📔 icon, or assign it a global shortcut in Settings. Notes keeps a compact 570 × 404 layout inspired by Raycast Notes, with rounded corners and a centered muted note title, while using Conjure’s shared warm gradient background, cream text, and amber list markers and caret. The title bar offers Close, **Actions** (⌘), **Browse Notes** (note icon), and **New Note** (+). Browse Notes (Command-P) opens Conjure’s styled, scrollable searchable picker below the title bar, shared with translation language selection—not a native menu. Fuzzy-search note titles, then select with Up/Down, Control-J/K, and Return or by clicking a note. A checkmark marks the current note, which is selected and scrolled into view on opening. Reopening Notes restores the last selection. Each note’s first nonempty line becomes its title; duplicate titles remain independently selectable. Actions (Command-K) opens the same searchable popup style used throughout Conjure, with **Browse Notes** (Command-P) and **New Note** (Command-N). Command-N creates a note while the editor or either popup is focused. Command-P toggles Browse Notes even while its title-bar controls are covered. Escape or clicking outside closes an open popup and returns focus to the editor without leaving Notes; another Escape dismisses the launcher. Control-J/K navigates only while a popup is open, preserving normal editor commands when it is closed. @@ -157,7 +157,7 @@ Typing, pasting, and Return at the visible start of an item use the position aft Fenced code uses [HighlighterSwift](https://github.com/smittytone/HighlighterSwift) (Highlight.js) for language-aware token colors. Add a language after the opening backticks or tildes, for example `py`, `python`, `swift`, `js`, or `json`. Unlabeled fences use automatic detection; unknown languages remain plain monospace. Highlighting runs entirely offline. -Notes autosave locally as RTFD packages, including embedded images, under `~/Library/Application Support/Conjure/Notes`. No account, network access, or cloud sync is involved. Save failures appear below the editor and prevent switching, closing, or quitting until saving succeeds, preserving the unsaved buffer. The red Close button and Command-W dismiss Conjure, including any open popup; leaving Notes or switching destinations removes its popup completely and restores the launcher’s original dimensions. +Notes autosave locally as RTFD packages, including embedded images, under `~/Library/Application Support/Conjure/Notes`. No account, network access, or cloud sync is involved. Save failures appear below the editor and prevent switching, closing, or quitting until saving succeeds, preserving the unsaved buffer. The Close button and Command-W dismiss Conjure, including any open popup; leaving Notes or switching destinations removes its popup completely and restores the launcher’s original dimensions. ## Translation diff --git a/Sources/Conjure/NotesController.swift b/Sources/Conjure/NotesController.swift index 2e17f91..e914cf2 100644 --- a/Sources/Conjure/NotesController.swift +++ b/Sources/Conjure/NotesController.swift @@ -4,10 +4,6 @@ import Highlighter @MainActor enum NotesAppearance { - static let background = NSColor(white: 0.035, alpha: 1) - static let text = NSColor(white: 0.94, alpha: 1) - static let muted = NSColor(white: 0.58, alpha: 1) - static let accent = NSColor(srgbRed: 1, green: 0.36, blue: 0.39, alpha: 1) static let font = NSFont.systemFont(ofSize: 17) static let paragraph: NSParagraphStyle = { let style = NSMutableParagraphStyle() @@ -49,18 +45,16 @@ final class NotesController: NSViewController, NSTextViewDelegate { let content = NotesView() content.commandShortcut = { [weak self] in self?.handleCommandKey($0) ?? false } view = content - content.wantsLayer = true - content.layer?.backgroundColor = NotesAppearance.background.cgColor let close = iconButton("circle.fill", label: "Close notes", action: #selector(closeWindow)) - close.contentTintColor = NotesAppearance.accent + close.contentTintColor = SunsetPalette.accent close.isBordered = false - close.image = close.image?.withSymbolConfiguration(.init(paletteColors: [NotesAppearance.accent])) + close.image = close.image?.withSymbolConfiguration(.init(paletteColors: [SunsetPalette.accent])) let lights = NSStackView(views: [close]) lights.spacing = 8 for _ in 0..<2 { let dot = NSView() dot.wantsLayer = true - dot.layer?.backgroundColor = NSColor(white: 0.15, alpha: 1).cgColor + dot.layer?.backgroundColor = SunsetPalette.secondaryText.withAlphaComponent(0.18).cgColor dot.layer?.cornerRadius = 6 dot.setAccessibilityElement(false) NSLayoutConstraint.activate([dot.widthAnchor.constraint(equalToConstant: 12), dot.heightAnchor.constraint(equalToConstant: 12)]) @@ -77,7 +71,7 @@ final class NotesController: NSViewController, NSTextViewDelegate { let controls = NSStackView(views: [actionsButton, browseButton, create]) controls.spacing = 2 noteTitle.font = .systemFont(ofSize: 13) - noteTitle.textColor = NotesAppearance.muted + noteTitle.textColor = SunsetPalette.secondaryText noteTitle.alignment = .center noteTitle.lineBreakMode = .byTruncatingTail noteTitle.setAccessibilityLabel("Note title") @@ -122,9 +116,9 @@ final class NotesController: NSViewController, NSTextViewDelegate { editor.importsGraphics = true editor.allowsUndo = true editor.drawsBackground = false - editor.textColor = NotesAppearance.text - editor.insertionPointColor = NotesAppearance.accent - editor.selectedTextAttributes = [.backgroundColor: NotesAppearance.accent.withAlphaComponent(0.25)] + editor.textColor = SunsetPalette.text + editor.insertionPointColor = SunsetPalette.accent + editor.selectedTextAttributes = [.backgroundColor: SunsetPalette.selectionFill] editor.font = NotesAppearance.font editor.defaultParagraphStyle = NotesAppearance.paragraph editor.isAutomaticQuoteSubstitutionEnabled = false @@ -143,7 +137,7 @@ final class NotesController: NSViewController, NSTextViewDelegate { scroll.drawsBackground = false scroll.scrollerStyle = .overlay status.font = .systemFont(ofSize: 12) - status.textColor = NotesAppearance.muted + status.textColor = SunsetPalette.secondaryText status.setAccessibilityLabel("Notes save status") status.lineBreakMode = .byTruncatingTail status.setContentCompressionResistancePriority(.defaultLow, for: .horizontal) @@ -196,7 +190,7 @@ final class NotesController: NSViewController, NSTextViewDelegate { button.imagePosition = .imageOnly button.bezelStyle = .accessoryBarAction button.showsBorderOnlyWhileMouseInside = true - button.contentTintColor = NotesAppearance.muted + button.contentTintColor = SunsetPalette.secondaryText button.toolTip = label button.setAccessibilityLabel(label) NSLayoutConstraint.activate([button.widthAnchor.constraint(equalToConstant: 28), button.heightAnchor.constraint(equalToConstant: 28)]) @@ -528,7 +522,7 @@ enum MarkdownHighlighting { (try! NSRegularExpression(pattern: "(?m)^#{1,6} .+$"), [.font: NSFont.systemFont(ofSize: 23, weight: .semibold)]), (try! NSRegularExpression(pattern: "\\*\\*[^\\n]+?\\*\\*|__[^\\n]+?__"), [.font: NSFont.boldSystemFont(ofSize: 17)]), (try! NSRegularExpression(pattern: "(? 🦊 first\n> second\n> untouched\u{fffc}") #expect(editor.markdownContents.attribute(.attachment, at: editor.markdownContents.length - 1, effectiveRange: nil) is NSTextAttachment) - editor.undoManager?.endUndoGrouping() editor.undoManager?.undo() try #require(editor.markdownString == before) #expect(editor.markdownContents.attribute(.attachment, at: editor.markdownContents.length - 1, effectiveRange: nil) is NSTextAttachment)