Skip to content

evedes/nuri

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NURI

塗り (nuri) — Japanese for "to paint" or "to coat"

Generate color themes from wallpaper images. Supports Ghostty, Zellij, and Neovim backends.

nuri-generated theme applied to Ghostty, Zellij, and Neovim

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.

Examples

See EXAMPLES.md for more screenshots of nuri-generated themes in action.

How it works

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)

Installation

cargo install --path .

Usage

# 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 blue

nuri 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

All options

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]

Development

cargo build                  # Build
cargo test                   # Run tests
cargo clippy                 # Lint
cargo fmt --check            # Check formatting
./check.sh                   # Run all checks (fmt, clippy, test, build)

Tech stack

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

License

MIT

About

nuri** (塗り) — Japanese for "to paint" or "to coat". From the verb 塗る (*nuru*), meaning to apply color onto a surface. The name reflects what the tool does: it coats your terminal, multiplexer, and editor with colors extracted from your wallpaper.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors