1pub use color::*;
3
4pub mod palettes;
6pub use ::color::HueDirection;
7
8pub mod prelude {
10 pub use super::{color, try_color};
11 pub use super::{rgb, rgb8, rgba, rgba8};
12}
13
14pub const fn rgb8(r: u8, g: u8, b: u8) -> AlphaColor<Srgb> {
16 OpaqueColor::from_rgb8(r, g, b).with_alpha(1.0)
17}
18
19pub const fn rgba8(r: u8, g: u8, b: u8, a: u8) -> AlphaColor<Srgb> {
21 AlphaColor::from_rgba8(r, g, b, a)
22}
23
24pub const fn rgb(r: f32, g: f32, b: f32) -> AlphaColor<Srgb> {
26 OpaqueColor::new([r, g, b]).with_alpha(1.0)
27}
28
29pub const fn rgba(r: f32, g: f32, b: f32, a: f32) -> AlphaColor<Srgb> {
31 AlphaColor::new([r, g, b, a])
32}
33
34pub fn color(color_str: &str) -> AlphaColor<Srgb> {
38 parse_color(color_str)
39 .expect("Invalid color string")
40 .to_alpha_color::<Srgb>()
41}
42
43pub fn try_color(color_str: &str) -> Result<AlphaColor<Srgb>, ParseError> {
47 parse_color(color_str).map(|c| c.to_alpha_color::<Srgb>())
48}