塗り (nuri) — Japanese for "to paint" or "to coat"
Generate color themes from wallpaper images. Supports Ghostty, Zellij, and Neovim backends.
nuri extracts dominant colors from an image using K-means clustering, maps them to ANSI palette slots via perceptual hue matching, enforces WCAG contrast minimums, and outputs a ready-to-use theme file.
See EXAMPLES.md for more screenshots of nuri-generated themes in action.
Image → resize 256x256 → K-means (LAB, K=16) → deduplicate → detect dark/light
→ hue-based ANSI slot assignment (Oklch) → bright variants → derive special colors
→ WCAG contrast enforcement → theme file
- K-means in LAB space for perceptually diverse palette extraction
- Oklch color space for all lightness, chroma, and hue adjustments
- WCAG 2.0 contrast enforcement: 4.5:1 for accents, 7:1 for foreground, 3:1 for bright-black
- Auto dark/light detection based on image luminance (overridable)
cargo install --path .# Launch with default settings
nuri ~/wallpapers/sunset.jpg
# Target specific backend(s)
nuri ~/wallpapers/sunset.jpg --target zellij
nuri ~/wallpapers/sunset.jpg --target ghostty,zellij,neovim
# Force light mode
nuri ~/wallpapers/sunset.jpg --mode light
# Use a monochromatic accent palette
nuri ~/wallpapers/sunset.jpg --accent bluenuri launches an interactive TUI for previewing and tweaking the generated palette before saving. Keybindings:
| Key | Action |
|---|---|
d / l |
Toggle dark/light mode |
r |
Regenerate palette (new K-means seed) |
Tab / Shift+Tab |
Cycle through palette slots |
1-6 |
Select accent slot |
+ / - |
Adjust lightness (selected slot) |
s / S |
Adjust chroma (selected slot) |
Left / Right |
Cycle extracted colors (selected slot) |
Enter |
Save theme |
q |
Quit |
? |
Help |
nuri [OPTIONS] <IMAGE>
Arguments:
<IMAGE> Path to the input image
Options:
-n, --name <NAME> Theme name (defaults to image filename)
-m, --mode <MODE> Force dark or light [values: dark, light]
-t, --target <TARGET> Backend(s), comma-separated [values: ghostty, zellij, neovim]
-k, --colors <N> K-means clusters [default: 16]
--min-contrast <RATIO> Minimum accent contrast ratio [default: 4.5]
--accent <COLOR> Monochromatic palette [values: blue, green, yellow, red, purple, gray]
cargo build # Build
cargo test # Run tests
cargo clippy # Lint
cargo fmt --check # Check formatting
./check.sh # Run all checks (fmt, clippy, test, build)| Crate | Purpose |
|---|---|
| clap | CLI argument parsing |
| image | Image loading and resizing |
| kmeans-colors | K-means clustering for color extraction |
| palette | Color space conversions (sRGB, LAB, Oklch) |
| ratatui | Terminal UI framework |
| crossterm | Terminal backend for ratatui |
| anyhow | Error handling |
MIT
