depictr.palette_safety#
- depictr.palette_safety(colours=None, threshold=5.0)#
Check that a palette stays distinguishable under each deficiency.
For normal vision and each deficiency at full severity, the palette’s colours are converted to CIE L*a*b* and the smallest pairwise colour difference (CIE76 Delta-E) is found. The lower this minimum, the more likely two categories are to be confused. A palette is reported safe when the minimum across all conditions is at least
threshold.The default
thresholdof 5.0 is calibrated against the reference colourblind-safe palette: the Okabe-Ito set’s tightest pair (reddish-purple against grey) sits at Delta-E 7.4 under full deuteranopia, so the cut must lie below that to pass the recommended palette, while still flagging colours that become near-identical under a deficiency. The difference includes lightness, which survives colour-vision deficiency, so two colours that share a hue but differ in lightness are correctly treated as distinguishable. Full severity is the worst case; most colour-vision deficiency is milder.- Parameters:
- Returns:
min_delta_e(the worst case across conditions),by_condition(the minimum Delta-E for normal vision and each deficiency),worst_conditionandworst_pair(the closest colours and where),safe(whethermin_delta_emeetsthreshold) andthreshold.- Return type: