Crate color_parser

Source
Expand description

A utility library for parsing and converting colors between different formats.

Supports conversion between:

  • Hexadecimal (#RRGGBB, #RRGGBBAA, #RGB, #RGBA) and Rgba
  • Rgba to Hsl, Hsv, and Cmyk

§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§

ColorParserError
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.