Expand description
§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
Re-exports§
pub use color_names::*;pub use color_palette::*;pub use color::*;
Modules§
- color
- Color Utilities
- color_
names - HTML Color Names
- color_
palette - Color Palettes and Scaling
Structs§
- Hsl
- HSL color space.
- Hsluv
- HSLuv color space.
- Hsv
- HSV color space.
- Hwb
- HWB color space.
- Lab
- The CIE L*a*b* (CIELAB) color space.
- Lch
- CIE L*C*h°, a polar version of CIE L*a*b*.
- Okhsl
- A Hue/Saturation/Lightness representation of
Oklabin thesRGBcolor space. - Okhsv
- A Hue/Saturation/Value representation of
Oklabin thesRGBcolor space. - Okhwb
- A Hue/Whiteness/Blackness representation of
Oklabin thesRGBcolor space, similar toHwb. - Oklab
- The Oklab color space.
- Oklch
- Oklch, a polar version of Oklab.
- Xyz
- The CIE 1931 XYZ color space.
Traits§
- Lighten
- Operators for lightening a color.
- Shift
Hue - Operator for increasing or decreasing the hue by an amount.
Type Aliases§
- Hsla
- Linear HSL with an alpha component. See the
Hslaimplementation inAlpha. - Hsluva
- HSLuv with an alpha component. See the
Hsluvaimplementation inAlpha. - Hsva
- Linear HSV with an alpha component. See the
Hsvaimplementation inAlpha. - Hwba
- Linear HWB with an alpha component. See the
Hwbaimplementation inAlpha. - Laba
- CIE L*a*b* (CIELAB) with an alpha component. See the
Labaimplementation inAlpha. - Lcha
- CIE L*C*h° with an alpha component. See the
Lchaimplementation inAlpha. - Okhsla
- Okhsl with an alpha component.
- Okhsva
- Okhsv with an alpha component. See the
Okhsvaimplementation inAlpha. - Okhwba
- Okhwb with an alpha component. See the
Okhwbaimplementation inAlpha. - Oklaba
- Oklab with an alpha component.
- Oklcha
- Oklch with an alpha component. See the
Oklchaimplementation inAlpha. - Srgb
- Non-linear sRGB, the most common RGB input/output format.
- Srgba
- Non-linear sRGB with an alpha component.
- Xyza
- CIE 1931 XYZ with an alpha component. See the
Xyzaimplementation inAlpha.