parse_rgb_to_hsv

Function parse_rgb_to_hsv 

Source
pub fn parse_rgb_to_hsv(color: &Rgba) -> Result<Hsv, ColorParserError>
Expand description

Converts an Rgba color to the HSV color space.

§Errors

Returns InvalidRgbValue if RGB values are outside the 0–255 range.

§Examples

use color_parser::{Rgba, parse_rgb_to_hsv};

let rgba = Rgba { red: 0, green: 255, blue: 0, alpha: 255 };
let hsv = parse_rgb_to_hsv(&rgba).unwrap();
assert_eq!(hsv.hue.round(), 120.0);