Skip to main content

lc

Function lc 

Source
pub fn lc(text: Color, background: Color) -> f32
Expand description

The lightness contrast of text over background, alpha ignored (a translucent text is first painted over the background). Positive for dark text on a light background, negative for light text on a dark one; 0 when the two are too close to tell.

use egui_pop_tokens::{Color, apca};

let lc = apca::lc(Color::BLACK, Color::WHITE);
assert!((lc - 106.04).abs() < 0.1);
assert!(apca::lc(Color::WHITE, Color::BLACK) < -107.0);