35 ms·
One thing the article doesn't mention: getting a set of maximally visually distinct colours. The best algorithm I'm familiar with for this is to iteratively cho
by rcfox 13y ago
One thing the article doesn't mention: getting a set of maximally visually distinct colours. The best algorithm I'm familiar with for this is to iteratively choose colours as far away as possible from each other in Lab space (while still being able to map into RGB). You can also make sure that the colours stand out against your background by pre-seeding the space with your background colour.
However, it's not a fast algorithm. The more colours you choose, the slower each iteration gets, since you have to calculate the distances from a growing set of colours. Also, after ~10, the distinctness seems to drop off pretty quickly. Lastly, assuming you're seeding with the same colours, you'll always get the same result, so it's really best to do the calculations once and then cache them.
- jacobolus 13y agoThat's not the worst method you could choose, but just be warned: CIELAB space was designed with the goal that any pair of colors separated by about 1 unit (i.e. ΔE = 1) would have a similar degree of apparent difference. However, apparent color differences are a highly non-linear property, and so by the point ΔE gets past 5 or 10, a specific color difference in one direction or one part of the color space will be substantially different than a same-distance color difference in another part of the space. Often, the reason you want to carefully pick a color scheme is to make sure that two areas of a graphic are easily visually distinguishable along an edge. Because human vision mainly uses a monochromatic color signal for distinguishing shape, texture, and the finest details, the most important difference to make between a pair or set of colors is to separate them in the lightness (in CIELAB, that's L) dimension. If you have sufficient lightness contrast, then any particular choices of a and b (or hue and chroma) will work fine. If you don’t have sufficient lightness contrast, changing the other color components won’t help much: even if you maximally separate them in the color space, they’ll just appear to mush together in a clashing way along edges. [edit: removed asterisks from L*, etc. because HN thinks they should be for italicizing]
- taliesinb 13y agoTo supplement your point about L being the most important ordinate for distinguishing bordering colors: that is certainly true, but there are three other properties one wants for data visualization: 1. Once you've seen a colored element in the graphic, you want to quickly match it to its corresponding element in a legend (or vice versa). Having distinct hue and chroma is more important for this, because lightness is so vulnerable to your brain's tendency to 'correct' it based on contextual cues. 2. Hues should be aesthetically pleasing. 3. Lightness tends to impart connotations to an visualization: class X is more important than other classes if it is substantially darker or lighter. Same goes for chroma. So one wants to bound lightness and chroma to within a specific range when using them for class labeling. Another deep complication is color impossibility, which is another way of saying that for any reasonably perceptually uniform color space like CIELAB, there is no straight-forward parametrization of the space that is both linear and avoids impossible colors. My gut instinct is that space-filling curves could play a greater role in parameterizing the valid portions of such color spaces. Desiderata 3 is suggestive: we want some parameter that 'wiggles' within the allowed range of lightness and chroma to achieve both good distinction between nearby parameterized colors, and good global uniformity of color and chroma. This wiggling could also 'absorb' the 'nooks and crannies' that color impossibility produces. Still a research project, though.
- deleted 13y ago[deleted]