contrast

Crates.iocontrast
lib.rscontrast
version0.1.1
created_at2019-09-07 14:28:28.719017+00
updated_at2025-05-31 12:21:42.488189+00
descriptionCalculate contrast between two colors
homepage
repositoryhttps://codeberg.org/icewind/contrast
max_upload_size
id162975
size21,545
Robin Appelman (icewind1991)

documentation

https://docs.rs/contrast/

README

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.

Commit count: 0

cargo fmt