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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
//! This is a very simple and easy-to-use color conversion tool that can easily convert colors between Hex, RGB, RGBA, HSL, HSLA, HSV, and CMYK.
//! And each type has its unique API, such as RGB can set color channels, RGBA can set transparency, HSL can set hue, saturation, and brightness, and so on.
//! ### example:
//! ```rust
//! let hex:Hex = "#2bc48a".try_into().unwrap();
//!
//! let mut rgb:RGB = hex.into();
//! assert_eq!(rgb.to_string(), "rgb(43,196,138)");
//! rgb.set_red(255);
//! assert_eq!(rgb.to_string(), "rgb(255,196,138)");
//!
//! let mut rgba:RGBA = rgb.into();
//! rgba.set_alpha(0.5);
//! assert_eq!(rgba.to_string(), "rgba(255,196,138,0.50)");
//!
//! let mut hsl:HSL = rgba.into();
//! hsl.set_hue(240);
//! assert_eq!(hsl.to_string(), "hsl(240,100%,88%)");
//!
//! let hex:Hex = hsl.into();
//! assert_eq!(hex.to_string(), "#C2C1FF");
//! ```
pub use CMYK;
pub use ColorError;
pub use Hex;
pub use HSL;
pub use HSLA;
pub use HSV;
pub use RGB;
pub use RGBA;
pub use *;