Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Picker

A native macOS menu-bar color and font picker with Liquid Glass.

Grab any pixel on screen as HEX, RGB, or HSL. Click any text in any app to grab its font. Both go into a saved list.

macOS 26+ Swift 6.2 License: MIT


Picker showing a sampled color with HEX, RGB and HSL plus a saved palette    Picker's Fonts section showing a grabbed font's specimen and saved fonts



Grab Font in action: the overlay highlights a heading on a web page and reads its family, weight, and size

Grab Font reading a heading straight off a web page — family, weight, and size.


What it does

Picker lives in your menu bar. One click opens a panel with two tools:

  • Colors: Pick a Color turns the cursor into a magnified loupe. Click a pixel to get HEX, RGB, and HSL, saved to your palette.
  • Fonts: Grab Font turns the cursor into a text picker. A crosshair follows the text under the cursor and reads its family and size; click to keep it.

A sliding pill switches between the two sections.

Features

  • Magnified-pixel sampling: the native loupe magnifies the screen pixel by pixel, so you get the one you aimed at.
  • Grab any font, anywhere: a click-through overlay reads text under the cursor through the accessibility tree, so web pages (Safari/WebKit and Chrome/Chromium), native apps, and already-open dropdowns all work. The highlight hugs the text run, not the surrounding box.
  • Liquid Glass: a real macOS 26 glass panel.
  • HEX, RGB, HSL: all three at once. Click a value to copy it and the icon flips to a checkmark.
  • Real-typeface specimen: grabbed fonts render in their actual face. Picker downloads and registers a font you don't have, from Google Fonts or Fontsource. Faces you can't legally download fall back to a system preview.
  • Find any font: Find deep-links to a font's Google Fonts page when it's free, and otherwise web-searches the family name in Safari, which also turns up commercial and self-hosted faces.
  • Saved palette and font list: strips of everything you've grabbed. Click to copy, hover to delete, scroll the row with your mouse wheel.
  • Readable on any color: the ink flips between black and white by perceived brightness, so the hex stays legible on saturated and dark colors.
  • Out of the way: no dock icon, one menu-bar click away.
  • Zero dependencies: a single Swift package.

Requirements

  • macOS 26 (Tahoe) or later. Liquid Glass and the loupe need the macOS 26 SDK.
  • Xcode 26 / Swift 6.2 to build
  • Grab Font needs Accessibility permission (macOS prompts on first use)
  • Grabbing fonts in Chrome/Chromium also needs scripted access to the page: enable View ▸ Developer ▸ Allow JavaScript from Apple Events in Chrome, and grant Picker Automation access to the browser when prompted. Safari and native apps need neither.

Build & run

git clone https://github.com/Entrepenulian/Picker.git
cd Picker
./build.sh            # compiles and assembles build/Picker.app
open build/Picker.app # launches the menu-bar agent

An eyedropper appears in your menu bar:

  • Left-click it to open the panel.
  • Right-click it to quit.

To make it Spotlight-launchable, drag build/Picker.app into /Applications.

Signing: build.sh signs with a Developer ID identity when one is in your keychain, and falls back to ad-hoc. The Grab Font Accessibility grant keys on the signing identity, so a stable one means granting it once instead of every rebuild.

How it's built

SwiftUI + AppKit, no third-party code.

  • Shell: a borderless, non-activating NSPanel anchored under an NSStatusItem, hosting SwiftUI through NSHostingController. It runs its own panel instead of MenuBarExtra so the glass stays open while you sample.
  • Glass: SwiftUI's glassEffect for the panel surface and the primary button.
  • Color sampling: NSColorSampler, the same magnified loupe Apple's own color picker uses.
  • Font grabbing: a full-screen, click-through, accessibility-invisible overlay plus a CGEventTap that consumes mouse events so the page underneath stays inert. A system-wide AXUIElementCopyElementAtPosition reads through the overlay and descends to the deepest AXStaticText leaf. The font comes from WebKit text-marker attributes, with a char-range fallback for native text.
  • Chromium support: Chromium's accessibility hit test returns a giant scroll container instead of the run, and never reports the font family. So Picker locates the run by geometry (deepest AXStaticText whose frame contains the pointer, from the app root) and reads family, size, and weight from getComputedStyle through an in-process NSAppleScript "execute javascript" call, roughly 10ms, warmed at launch. It also wakes Chromium's lazily-built AX tree when the picker starts.
  • Real faces: for a font that isn't installed, FontLoader pulls it from the Google Fonts css2 catalog (or Fontsource on jsDelivr) and registers it with CTFontManagerRegisterFontsForURL, which loads TTF/WOFF/WOFF2 by content. Variable fonts that register under a named-instance family are remapped via the font's own descriptor so the specimen still renders.
  • Contrast: ink chosen by YIQ perceived brightness (0.299·R + 0.587·G + 0.114·B), which keeps white text on saturated and dark colors.
  • Persistence: the palette and font list are JSON in UserDefaults.
Sources/Picker/
├── App.swift           # NSStatusItem + floating panel + sampling + font picking
├── PanelView.swift     # the whole UI: hero card, formats, palette, fonts section
├── Model.swift         # PickedColor, the color store, color math
├── Fonts.swift         # PickedFont and the font store
├── FontPicker.swift    # click-to-grab overlay (CGEventTap + accessibility reading)
├── FontLoader.swift    # downloads/registers real faces + Find URL routing
├── DesignSystem.swift  # tokens: ink, spacing, radii, motion
└── ColorSampler.swift  # NSColorSampler wrapper

License

MIT. See LICENSE.

About

A native macOS menu-bar color picker with Liquid Glass — magnified-pixel sampling, instant HEX/RGB/HSL, and a saved palette.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages