Skip to content

Add persistent color history bar#177

Closed
nwoodfine wants to merge 1 commit intosuperhighfives:mainfrom
nwoodfine:color-history-2
Closed

Add persistent color history bar#177
nwoodfine wants to merge 1 commit intosuperhighfives:mainfrom
nwoodfine:color-history-2

Conversation

@nwoodfine
Copy link
Copy Markdown

@nwoodfine nwoodfine commented Mar 1, 2026

Summary (1/3)

Addresses #139

Adds a color history bar below the footer showing recently picked colors. Tapping a swatch applies it as the foreground and copies to clipboard.

new-color-history
Pika with color history feature

This is PR 1 of 3 in a stacked series:

  1. Color History (this PR) → base: main
  2. Custom Color Palettes (Add custom color palette library with iCloud sync #178) → base: main (depends on PR 1)
  3. Menubar Popover Mode (Add menubar popover mode with window option #176) → base: main (depends on PRs 1 & 2)

new-color-history-palettes
Pika in native menu bar popover with both color history + custom color palettes

Changes

  • ColorHistoryManager: MRU list (max 20) with immediate and debounced recording, persisted via UserDefaults
  • SwatchBar: Reusable swatch component shared with the palette feature in PR 2
  • SwatchSectionStyle: Shared styling modifier for consistent swatch bar appearance
  • Refactored system color picker to use togglePicker() directly instead of notification-based dispatch
  • Refactored triggerSwap to perform swap inline in AppDelegate
  • Dynamic window resizing when history appears/disappears
  • SwatchLayout.totalHeight(base:hasHistory:paletteCount:) for shared height calculation

New files

  • Pika/Utilities/ColorHistoryManager.swift
  • Pika/Views/ColorHistory.swift
  • Pika/Views/SwatchBar.swift

Testing

  • Built and tested with Xcode 26.3 on macOS 26.3

Note on dependencies

These changes were developed and tested with locally updated dependencies. The PRs intentionally do not include these dependency bumps — they remain on the versions currently in main. The features do not require the newer versions to build or run. For reference, the development environment used:

Dependency main version Dev/test version
SwiftLint (Mintfile) 0.52.4 0.57.1
SwiftFormat (Mintfile) 0.55.1 0.55.5
KeyboardShortcuts (SPM) 2.3.0 2.4.0
Sparkle (SPM) revision 891afd44c707 2.9.0

Test plan

  • Pick colors and verify they appear in the history bar
  • Verify window resizes when history first appears
  • Tap a history swatch — should apply as foreground and copy
  • Quit and relaunch — history should persist
  • Verify system color picker toggle works correctly
  • Verify swap button still works

Addresses superhighfives#139

Adds a color history bar below the footer showing recently picked colors.
Tapping a swatch applies it as the foreground and copies to clipboard.

- ColorHistoryManager: MRU list with immediate and debounced recording
- SwatchBar: Reusable swatch component (shared with future palette feature)
- Refactored system color picker to use togglePicker() directly
- Dynamic window resizing when history appears/disappears
@superhighfives
Copy link
Copy Markdown
Owner

Okay, so I really like this idea, and it got me thinking about color history and palettes in general, which led me to building out #183. I've refactored a lot of the app in the process, so I'm going to close this in favor of that, but a massive thanks for the inspiration. It also lays the foundations for having palettes, which I want to keep exploring.

I realize not getting a PR merged maybe doesn't feel great, but I can assure you the effort you put in was appreciated and has made it to its own version of the light of day. Thank you, @nwoodfine! Aiming to have a beta out once #189 is approved and merged in. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants