1 unstable release
| 0.2.0 | Jul 15, 2025 |
|---|
#1396 in Images
76 downloads per month
Used in 5 crates
(4 directly)
65KB
1.5K
SLoC
Wassily Color
Color utilities and palette management for the wassily generative art library. This crate provides comprehensive color manipulation tools including color space conversions, palette extraction from images, procedural color generation, and advanced color operations specifically designed for generative art applications.
Key Features
- Rich Color Spaces: Support for RGB, HSL, HSV, Okhsl, Lab, and many more
- Palette Management: Create, manipulate, and extract color palettes
- Named Colors: Complete set of HTML/CSS color names
- Procedural Generation: Generate random colors in perceptually uniform spaces
- Image Extraction: Extract dominant colors from images
- Advanced Operations: Color blending, scaling, and fourier-based palettes
Modules
color_names: Pre-defined HTML/CSS color constantscolor_palette: Palette management and color scaling functionscolor: Core color utilities, conversions, and generation functions
Quick Start
use wassily_color::*;
use tiny_skia::Color;
// Use named colors
let blue = *CORNFLOWERBLUE;
let red = *CRIMSON;
// Create random colors in perceptually uniform space
let mut rng = rand::thread_rng();
let random_color = rand_okhsl(&mut rng);
// Create a color palette
let palette = Palette::new(vec![blue, red, random_color]);
// Create a color scale for smooth transitions
let scale = ColorScale::new(blue, red, *WHITE, *BLACK, random_color);
let interpolated = scale.get_color(0.5);
Color Spaces
This crate emphasizes modern, perceptually uniform color spaces:
- Okhsl/Okhsv: Perceptually uniform HSL/HSV variants
- Lab/Lch: Perceptually uniform lightness and chroma
- Traditional: RGB, HSL, HSV for compatibility
Advanced Features
- Fourier Color Scales: Mathematically smooth color transitions
- Image Color Extraction: Dominant color extraction from images
- Procedural Color Generation: Noise-based and algorithmic color creation
- Color Harmony: Tools for creating harmonious color relationships
Dependencies
~13MB
~254K SLoC