Expand description
A utility library for parsing and converting colors between different formats.
Supports conversion between:
- Hexadecimal (
#RRGGBB
,#RRGGBBAA
,#RGB
,#RGBA
) andRgba
Rgba
toHsl
,Hsv
, andCmyk
§Example
use color_parser::*;
let rgba = parse_hex_to_rgba("#ff8800").unwrap();
let hsl = parse_rgb_to_hsl(&rgba).unwrap();
let hsv = parse_rgb_to_hsv(&rgba).unwrap();
let cmyk = parse_rgb_to_cmyk(&rgba).unwrap();
Structs§
- Cmyk
- Represents a color in the CMYK color space.
- Hsl
- Represents a color in the HSL color space.
- Hsv
- Represents a color in the HSV color space.
- Rgba
- Represents a color in the RGBA color space.
Enums§
- Color
Parser Error - Errors that can occur during color parsing or conversion.
Functions§
- parse_
hex_ to_ rgba - Parses a hexadecimal color string into an
Rgba
struct. - parse_
rgb_ to_ cmyk - Converts an
Rgba
color to the CMYK color space. - parse_
rgb_ to_ hsl - Converts an
Rgba
color to the HSL color space. - parse_
rgb_ to_ hsv - Converts an
Rgba
color to the HSV color space.