Colorice
Colorice is a modern alternative to pywal that uses Oklab color space for perceptually accurate color extraction, generates multiple mood variants (vibrant, muted, warm, cool) to preview and select from, enforces WCAG contrast ratios, and applies schemes across your full desktop rice via a pywal-compatible template engine(yes existing pywal templates work) with color manipulation filters.
Install
Requires Python 3.11+.
pipx install colorice
Or with pip:
pip install colorice
Quick start
# Install default templates for common tools
colorice --init
# Generate a scheme and apply to your configured tools
colorice ~/wallpapers/sunset.jpg --apply
This will:
- Extract dominant colors using over-cluster + farthest-first diversity selection
- Generate 4 palette variants (vibrant, muted, warm, cool)
- Preview them in your terminal — pick one
- Write the scheme to
~/.local/share/colorice/colors.json - Render configured templates and reload your apps
Options
colorice <image> [options]
Extraction:
-c, --colors N Dominant colors to extract (3-16, default: 8)
--segment Region-aware extraction via Felzenszwalb segmentation
Palette:
-m, --moods MOOD[,...] Mood names (default: vibrant,muted,warm,cool)
--min-contrast RATIO Min fg/bg contrast ratio (default: 7.0)
--semantic Enforce ANSI color name conventions (red=red, etc.)
--light Light theme
Output:
-o, --output PATH Output JSON path (default: ~/.local/share/colorice/colors.json)
Use -o - for stdout
--no-preview Skip preview, output first palette
-q, --quiet Suppress all output except errors
Templates:
-a, --apply Apply scheme to configured templates
--config PATH Path to config.toml
--dry-run Preview template output without writing files
--no-hooks Skip post-apply hooks
--init Install default templates and exit
Info:
--list-moods List available mood names and exit
-v, --version Show version and exit
Examples
# Generate and interactively select a scheme
colorice ~/wallpapers/sunset.jpg
# Generate, select, and apply to all configured tools
colorice ~/wallpapers/sunset.jpg --apply
# Quiet mode, pipe JSON to stdout
colorice ~/wallpapers/ocean.png -q -o -
# Light theme with specific moods
colorice wallpaper.jpg --light -m vibrant,cool
# Region-aware extraction (better for complex images)
colorice wallpaper.jpg --segment --apply
# Re-apply existing scheme to templates (no image needed)
colorice --apply
# Preview template output without writing
colorice wallpaper.jpg --dry-run --apply
Template system
Colorice includes a pywal-compatible template engine. Templates use {color0} through {color15}, {background}, {foreground}, {cursor}, and {wallpaper} placeholders.
Setup
# Install bundled templates for common tools
colorice --init
This copies templates to ~/.config/colorice/templates/ for: kitty, alacritty, foot, ghostty, wezterm, hyprland, i3, sway, rofi, dunst, mako, waybar, polybar, swaylock, zellij, neovim, vim, cava, xresources, and shell variables.
Configuration
Edit ~/.config/colorice/config.toml to map templates to output paths:
[[templates]]
name = "kitty"
input = "kitty.conf"
output = "~/.config/kitty/current-theme.conf"
hook = "killall -USR1 kitty"
[[templates]]
name = "hyprland"
input = "hyprland-colors.conf"
output = "~/.config/hypr/colorice-colors.conf"
Then add the include directive in your app config (one-time setup):
- Kitty:
include ~/.config/kitty/current-theme.conf - Alacritty:
import = ["~/.config/alacritty/colorice-theme.toml"] - Hyprland:
source = ~/.config/hypr/colorice-colors.conf - i3/Sway:
include ~/.config/i3/colorice-colors.conf - See each template file for tool-specific instructions.
Color manipulation
Templates support Oklab color manipulation filters for deriving colors beyond the base 16:
{color4.lighten_20} Increase lightness by 0.20
{color0.darken_10} Decrease lightness by 0.10
{color1.saturate_15} Increase chroma by 0.15
{color5.desaturate_10} Decrease chroma by 0.10
{color4.lighten_20.strip} Manipulation + format modifier
Manipulations can be chained — they apply left to right:
{color4.lighten_20.saturate_10.strip}
{color0.darken_10.desaturate_5}
Format modifiers (always last in the chain):
.strip— hex without#(1a2b3c).red,.green,.blue— integer channel value (0-255).rgb—rgb(26,43,60).rgba—rgba(26,43,60,1.0)
How it works
- Extract — loads the image, resizes for performance, runs KMeans clustering in Oklab color space. Over-clusters to 4x the requested count, then uses farthest-first selection for maximum perceptual diversity. Optionally uses Felzenszwalb segmentation for region-aware extraction.
- Cache — extraction results are cached by image content hash + params in
~/.cache/colorice/. Same wallpaper with same settings skips re-extraction. - Mood transform — adjusts chroma, lightness, and hue for the selected mood variant.
- Assign roles — maps colors to 16 ANSI slots. In default (aesthetic) mode, sorts by chroma for wallpaper-matching palettes. In
--semanticmode, enforces hue-zone mapping (red=slot 1, green=slot 2, etc.). - Enforce contrast — binary search on Oklab lightness to meet WCAG contrast ratios against the background.
- Validate — warns about any ANSI color pairs that are too similar (pairwise Oklab distance check).
- Apply — renders templates with the scheme and runs post-apply hooks.
File locations (XDG-compliant)
~/.config/colorice/
config.toml Template configuration
templates/ Template files
~/.local/share/colorice/
colors.json Generated scheme
~/.cache/colorice/
<hash>.json Extraction cache
Respects $XDG_CONFIG_HOME, $XDG_DATA_HOME, and $XDG_CACHE_HOME.
Development
git clone https://github.com/rattle99/colorice.git
cd colorice
pip install -e ".[dev]"
pytest
License
GPL-3.0
Metadata
Release files for colorice 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| colorice-0.2.0.tar.gz | 60.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| colorice-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 120.5 kB
Release files / colorice-0.2.0.tar.gz
| Download URL | colorice-0.2.0.tar.gz |
|---|---|
| Size | 60.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aaab9225ad8fd20d7c14522589a2368c681522be584ed4b2b8ba4ca30a049558
|
|
BLAKE2b-256 checksum How to use checksums |
43c477cac4dbfd988750e91c7edeb73d28a78c5a55e85207e98bb1c3b9b5802f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 2, 2026.
Transparency logRelease files / colorice-0.2.0-py3-none-any.whl
| Download URL | colorice-0.2.0-py3-none-any.whl |
|---|---|
| Size | 60.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
81b3cd1269636313e8ff8c17aed356a317fb025126fe48216cfa157c28f256af
|
|
BLAKE2b-256 checksum How to use checksums |
4cb4ff9c67e256b0807ebca11b58ef08dc0fdb0a7c9f231d58febf86820df5a4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 2, 2026.
Transparency log