1 unstable release

0.1.0 Sep 7, 2019

#855 in Images

Download history 666/week @ 2024-03-13 704/week @ 2024-03-20 606/week @ 2024-03-27 459/week @ 2024-04-03 424/week @ 2024-04-10 444/week @ 2024-04-17 487/week @ 2024-04-24 274/week @ 2024-05-01 517/week @ 2024-05-08 297/week @ 2024-05-15 708/week @ 2024-05-22 277/week @ 2024-05-29 333/week @ 2024-06-05 496/week @ 2024-06-12 702/week @ 2024-06-19 575/week @ 2024-06-26

2,211 downloads per month
Used in 2 crates

MIT/Apache

7KB
56 lines

Contrast

Calculate contrast between two colors as specified by WCAG 2

Usage

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);
}

License

Licensed under either of

at your option.

Contribution

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.

Dependencies

~240KB