Skip to main content

derive_ink

Function derive_ink 

Source
pub fn derive_ink(hex: &str) -> AccentInk
Expand description

Pick an AAA-safe text color to pair with an accent fill.

Uses the classic YIQ luminance formula. Threshold 160 was chosen against the standard Wave Funk pastel palette and a fixture of 20 accents: it keeps every pastel above the line (black text) and every saturated deep color below (white text). Invalid hex falls back to white ink — safest for an accent we can’t reason about.