2 releases

new 0.1.1 May 31, 2025
0.1.0 Sep 7, 2019

#248 in Images

Download history 528/week @ 2025-02-13 1073/week @ 2025-02-20 1093/week @ 2025-02-27 1066/week @ 2025-03-06 400/week @ 2025-03-13 456/week @ 2025-03-20 775/week @ 2025-03-27 769/week @ 2025-04-03 652/week @ 2025-04-10 534/week @ 2025-04-17 822/week @ 2025-04-24 373/week @ 2025-05-01 565/week @ 2025-05-08 1505/week @ 2025-05-15 1361/week @ 2025-05-22 837/week @ 2025-05-29

4,357 downloads per month
Used in 2 crates

MIT/Apache

9KB
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

~285KB