- C 99.9%
- Makefile 0.1%
- xtk_entry.c from xtk: the right-click menu of a text field closed as soon as it opened. The menu's own keyboard grab sends the field a FocusOut, and the field hid its menu on it. - The version is 1.7. |
||
|---|---|---|
| screenshots | ||
| src | ||
| LICENSE | ||
| logo.png | ||
| Makefile | ||
| pixelprism.desktop | ||
| README.md | ||
Screenshots
PixelPrism
PixelPrism is a native X11 screen color picker for Linux. It provides a live magnifier, pixel-perfect picking, five simultaneous color-format readouts, one-click clipboard copy, and a system-tray workflow — all in a single compact window built without GTK, Qt, or any large widget toolkit.
Everything is built on xtk, a self-contained C17 Xlib widget library, using only Xlib, Xrender, and Xft.
- License: Artistic License 2.0 (see LICENSE)
The window
┌────────────────────────────┬──────────────────────────────┐
│ │ File Edit About │
│ │ │
│ │ HSV [ 0.0° 0.0% 36.9% ] │
│ LIVE MAGNIFIER │ HSL [ 0.0° 0.0% 31.0% ] │
│ (zoomed pixels around │ 0-1 [ 0.369, 0.369, … ] │
│ the pointer, with │ 0-255 [ 94, 94, 94 ] │
│ crosshair + capture │ Hex [ #5e5e5e ] │
│ square) │ │
│ │ ┌──────┐ ┌────────────┐ │
│ │ │swatch│ │ Pick Color │ │
│ │ └──────┘ └────────────┘ │
└────────────────────────────┴──────────────────────────────┘
One color is the ground truth: the current color drives every entry, the swatch, and the clipboard at once. Edit any format field — HSV, HSL, RGB float, RGB integer, or hex — and the others update immediately; pick from the screen and everything follows.
Features
Color picking
- Live zoom magnifier that tracks the pixels around the cursor, with a configurable crosshair and capture-square overlay
- Pick Color grabs the pointer for pixel-perfect selection: arrow keys nudge the cursor one pixel at a time, left-click picks, right-click or Escape cancels
- The last zoom capture and magnification level persist across runs; the capture is kept wider than the magnifier shows, so resizing the window or changing the magnification keeps showing the real pixels around the pick
Color formats
- Five synchronized, editable format entries:
- HSV —
24.0° 75.0% 100.0% - HSL —
24.0° 100.0% 62.7% - RGB float (0–1) —
1.000, 0.502, 0.251 - RGB integer (0–255) —
255, 128, 64 - Hex —
#ff8040, with configurable upper/lower case
- HSV —
- Full conversions provided by xtk's color-space library
- Entry validation with distinct valid/invalid border colors
Clipboard
- Ctrl+C copies from any field, Ctrl+V pastes hex into the hex field
- Optional auto-copy on pick in a configurable format
(hex, hsv, hsl, rgb, rgbi), optionally also to the X11 PRIMARY
selection, with or without the
#prefix
Swatch
- The current color in a rounded swatch whose border is derived from
the color itself in one of four harmony modes:
complementary(RGB inversion),inverse(HSV value inversion),triadic(channel rotation), orcontrast(black/white for maximum contrast)
System tray
- Freedesktop.org system-tray icon (XEmbed) with a themed context menu: Pick Color, Show/Hide Window, Copy as Hex, Exit
- Close-to-tray: with
minimize-to-trayenabled, closing the window hides it to the tray instead of exiting - Left-click the icon to toggle window visibility
- The icon appears when the panel starts after PixelPrism, and comes back when the panel restarts
State persistence
- Last picked color, window position (
remember-position), zoom magnification, and the last zoom capture are all restored on launch - Always-on-top available via
always-on-top
Theming
- Every widget's colors, fonts, sizes, border widths, radii, and padding are configurable in a single INI-style file
- A color may be written in any of the usual forms:
#RGB,#RRGGBB,#RRGGBBAA, six or eight hex digits without the#,rgb(),rgba(), orwhite,blackandtransparent; lines may be of any length - The config file is watched with inotify — edits apply live, no restart
- In-app settings changes are written back to the file on exit; recognized key values are preserved, but the whole file is regenerated from the in-memory config each time PixelPrism itself saves, so hand-added comments and unrecognized keys don't survive an app-triggered save
Building
PixelPrism builds with GCC (-std=gnu17) and pkg-config. It is
fully self-contained: src/ carries the application plus the xtk
widget sources it uses, so nothing outside this directory is needed.
Dependencies: x11 xrender xft fontconfig freetype2 (pkg-config)
plus libXext and libXpm.
make clean
make
The build is warning-clean under
-Wall -Wextra -Wpedantic -Wconversion -Wshadow -Werror. Unused
code is stripped from the binary via --gc-sections.
Running
./pixelprism
On first run PixelPrism has no config file yet, so it builds one entirely
from its built-in C defaults and writes it to
~/.config/pixelprism/pixelprism.conf — it does not read or copy any
template file. The pixelprism.conf at the root of this repository is a
reference copy of those same defaults, kept in sync for anyone browsing the
source; it isn't installed or consulted at runtime. Runtime files:
| Path | Contents |
|---|---|
~/.config/pixelprism/pixelprism.conf |
Full theme + behavior config, live-reloaded |
~/.config/pixelprism/window.dat |
Window position, last color, zoom magnification |
~/.config/pixelprism/last_zoom.dat |
Last zoom capture, restored at startup |
Keyboard
| Key | Action |
|---|---|
| Tab / Shift+Tab | Cycle focus through the format entries |
| Ctrl+C | Copy the focused entry |
| Ctrl+V | Paste into the hex entry |
| Escape | Cancel an active pick (it never quits) |
| Ctrl+Z / Ctrl+Y or Ctrl+Shift+Z | Undo / redo in the focused entry |
| Arrow keys | While picking: move the cursor one pixel |
Menus
- File → Exit — quit
- Edit → Configuration — open the config file in your editor
(the
editorkey in[paths]) - Edit → Reset — reset the current color to black
- View → Theme — "Config colors" (the colors in
pixelprism.conf) or one of the xtk themes (from~/.config/pixelprism/themes/and the installed ones); in the open menu, Right, Enter or the first letter opens the list and Left or Escape goes back - Help → PixelPrism — version and author information
Configuration
~/.config/pixelprism/pixelprism.conf is an INI-style file with a
section per widget plus behavior blocks. Highlights:
| Section | Controls |
|---|---|
[main] |
current-color, and icon-theme: PixelPrism's icons. Empty follows every xtk program's choice (theme in ~/.config/xtk/icons.conf, set in Unryu's, Hanshi's or Skein's Preferences); desktop is the desktop's icon theme (the one it announces, else GTK's or KDE's setting); builtin is xtk's own icons; or an installed icon theme's folder name, such as Papirus-Dark. A theme's icons show in its own colors, and PixelPrism follows a change of it while it runs |
[behavior] |
cursor, hex case, undo depth, show-tray-icon, minimize-to-tray, remember-position, always-on-top |
[clipboard] |
auto-copy, auto-copy-format, auto-copy-primary, hex-prefix |
[swatch] |
border color/width/radius and harmony border-mode |
[zoom] / [zoom-widget] |
crosshair and capture-square colors and visibility |
[sizes] |
main/about window and widget dimensions |
[paths] |
external editor and browser commands |
[button], [entry-*], [label], [menu], [menubar], [tray-menu], … |
per-widget styling |
See docs/CONFIGURATION.md for the complete key-by-key reference and docs/PIXELPRISM_USAGE.md for the full usage guide.
Project layout
| Path | Contents |
|---|---|
src/pixelprism.c |
Application: window, event loop, picking, state |
src/icons.c |
Application icon (XPM) |
src/xtk_*.[ch] |
The xtk widget toolkit modules used by the app |
pixelprism.conf |
Reference copy of the built-in defaults, kept in sync with what's generated at runtime — not read by the app itself |
docs/ |
Usage and configuration guides |
Makefile |
Build (all, clean, docs targets) |
License
Artistic License 2.0 — see LICENSE.