Crates.io | contrast |
lib.rs | contrast |
version | 0.1.0 |
source | src |
created_at | 2019-09-07 14:28:28.719017 |
updated_at | 2019-09-07 14:28:28.719017 |
description | Calculate contrast between two colors |
homepage | |
repository | https://github.com/icewind1991/contrast-rs |
max_upload_size | |
id | 162975 |
size | 16,973 |
Calculate contrast between two colors as specified by WCAG 2
use contrast::contrast;
use rgb::RGB8;
///
fn main() {
let contrast: f32 = contrast(RGB8::from([255, 255, 255]), RGB8::from([255, 255, 0]));
assert_eq!(contrast, 1.0738392);
}
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.