| 2168 | fn html_palette_covers_every_workflow_class_with_unique_high_contrast_colors() { |
| 2169 | use atomic_core::kg::ontology::Class; |
| 2170 | fn luminance(hex: &str) -> f64 { |
| 2171 | let channel = |offset| { |
| 2172 | let value = |
| 2173 | f64::from(u8::from_str_radix(&hex[offset..offset + 2], 16).unwrap()) / 255.0; |
| 2174 | if value <= 0.04045 { |
| 2175 | value / 12.92 |
| 2176 | } else { |
| 2177 | ((value + 0.055) / 1.055).powf(2.4) |
| 2178 | } |
| 2179 | }; |
| 2180 | 0.2126 * channel(1) + 0.7152 * channel(3) + 0.0722 * channel(5) |
| 2181 | } |
| 2182 | let colors: std::collections::HashSet<_> = Class::ALL |
| 2183 | .iter() |
| 2184 | .map(|class| super::html_node_color(class.iri())) |