1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//! Zero-dependency color library for the Optic engine.
//!
//! This crate provides color types, conversions, channel arithmetic, and
//! a gradient evaluator. It has no external dependencies and can be used
//! independently of the rest of the engine.
//!
//! # Types
//!
//! | Type | Components | Channels | Arithmetic |
//! |-------|------------|----------|------------|
//! | [`RGBA`] | red, green, blue, alpha | [`ChannelArray<4>`] | Add, Sub, Mul, Div |
//! | [`RGB`] | red, green, blue | [`ChannelArray<3>`] | Add, Sub, Mul, Div |
//! | [`HSV`] | hue, saturation, value | — | — |
//! | [`HSL`] | hue, saturation, lightness | — | — |
//!
//! `HSV` and `HSL` deliberately avoid arithmetic because hue wraparound
//! makes componentwise operations produce wrong colors. Convert to [`RGBA`]
//! first (via `.into()` or [`ToRgba`]), then operate, then convert back.
//!
//! # Conversions
//!
//! Every color type implements [`ToRgba`] and [`FromRgba`], so you can use
//! generics that accept "any color-like type":
//!
//! ```
//! use optic_color::*;
//!
//! fn set_bg(color: impl ToRgba) {
//! let rgba = color.to_rgba();
//! // ...
//! }
//! ```
//!
//! Direct `From` impls exist for all pairs:
//! - `From<RGB/HSV/HSL> for RGBA`
//! - `From<RGBA> for RGB/HSV/HSL`
//!
//! # Gradients
//!
//! [`Gradient`] supports multiple interpolation modes, color spaces,
//! and wrap modes:
//!
//! ```
//! use optic_color::*;
//!
//! let grad = Gradient::two_color(RED, BLUE)
//! .set_color_space(GradientColorSpace::Hsv);
//!
//! let mid = grad.sample(0.5); // RGBA
//! ```
//!
//! # Named colors
//!
//! The crate exports ~90 named [`RGBA`] constants (see [`optic_color::constants`]).
//! Examples: [`RED`], [`MIDNIGHT`], [`GOLD`], [`LAVENDER`], [`OBSIDIAN`].
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use ;