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
use crate::;
/// HSV color.
///
/// | Field | Range | Description |
/// |-------|-------|-------------|
/// | `h` | 0..360 | Hue angle (wraps at 360) |
/// | `s` | 0..1 | Saturation |
/// | `v` | 0..1 | Value (brightness) |
///
/// # Why no arithmetic?
///
/// `HSV` does not implement [`ChannelArray`], [`Add`], [`Sub`], [`Mul`],
/// or `lerp`. Hue is an angle on a circle — componentwise interpolation
/// between 350° and 10° would pass through 180° instead of the short arc
/// through 0°. This produces incorrect visual results.
///
/// To manipulate HSV colors, convert to [`RGBA`], do your math there,
/// then convert back:
///
/// ```
/// use optic_color::*;
///
/// let hsv = HSV::new(350.0, 0.8, 0.9);
/// let mut rgba: RGBA = hsv.into();
/// rgba = rgba.lighten(0.1);
/// ```
///
/// For hue-aware interpolation between two colors, use [`Gradient`] with
/// [`GradientColorSpace::Hsv`].
///
/// [`ChannelArray`]: crate::ChannelArray
/// [`Gradient`]: crate::Gradient