Skip to main content

wassily_color/
lib.rs

1//! # Wassily Color
2//! 
3//! Color utilities and palette management for the wassily generative art library.
4//! This crate provides comprehensive color manipulation tools including color space
5//! conversions, palette extraction from images, procedural color generation, and
6//! advanced color operations specifically designed for generative art applications.
7//!
8//! ## Key Features
9//!
10//! - **Rich Color Spaces**: Support for RGB, HSL, HSV, Okhsl, Lab, and many more
11//! - **Palette Management**: Create, manipulate, and extract color palettes
12//! - **Named Colors**: Complete set of HTML/CSS color names
13//! - **Procedural Generation**: Generate random colors in perceptually uniform spaces
14//! - **Image Extraction**: Extract dominant colors from images
15//! - **Advanced Operations**: Color blending, scaling, and fourier-based palettes
16//!
17//! ## Modules
18//!
19//! - **[`color_names`]**: Pre-defined HTML/CSS color constants
20//! - **[`color_palette`]**: Palette management and color scaling functions
21//! - **[`color`]**: Core color utilities, conversions, and generation functions
22//!
23//! ## Quick Start
24//!
25//! ```no_run
26//! use wassily_color::*;
27//! use tiny_skia::Color;
28//!
29//! // Use named colors
30//! let blue = *CORNFLOWERBLUE;
31//! let red = *CRIMSON;
32//!
33//! // Create random colors in perceptually uniform space
34//! let mut rng = rand::thread_rng();
35//! let random_color = rand_okhsl(&mut rng);
36//!
37//! // Create a color palette
38//! let palette = Palette::new(vec![blue, red, random_color]);
39//!
40//! // Create a color scale for smooth transitions
41//! let scale = ColorScale::new(blue, red, *WHITE, *BLACK, random_color);
42//! let interpolated = scale.get_color(0.5);
43//! ```
44//!
45//! ## Color Spaces
46//!
47//! This crate emphasizes modern, perceptually uniform color spaces:
48//!
49//! - **Okhsl/Okhsv**: Perceptually uniform HSL/HSV variants
50//! - **Lab/Lch**: Perceptually uniform lightness and chroma
51//! - **Traditional**: RGB, HSL, HSV for compatibility
52//!
53//! ## Advanced Features
54//!
55//! - **Fourier Color Scales**: Mathematically smooth color transitions
56//! - **Image Color Extraction**: Dominant color extraction from images
57//! - **Procedural Color Generation**: Noise-based and algorithmic color creation
58//! - **Color Harmony**: Tools for creating harmonious color relationships
59
60pub mod color_names;
61pub mod color_palette;
62pub mod color;
63
64// Re-export key types and functions for convenience
65pub use color_names::*;
66pub use color_palette::*;
67pub use color::*;
68
69// Re-export commonly used external types
70pub use palette::{
71    Hsl, Hsla, Hsluv, Hsluva, Hsv, Hsva, Hwb, Hwba, Lab, Laba, Lch, Lcha, Lighten, Okhsl, Okhsla,
72    Okhsv, Okhsva, Okhwb, Okhwba, Oklab, Oklaba, Oklch, Oklcha, ShiftHue, Srgb, Srgba, Xyz, Xyza,
73};