7EARTH

Palettes

A palette for every eye

Colour vision friendly palettes of 2 to 16 colours stay distinct for normal vision, for the three dichromacies and in grey.

“Considering the enormous variations in color vision deficiencies, it is difficult to come up with a color scheme that accommodates all types of deficiencies.”

— Thomas G. Wolfmaier

A chart, a map or a board game needs a few colours that nobody can mix up. Most palettes are made for normal colour vision, and about one man in twelve does not have it. The CVF (colour vision friendly) palettes are made for everyone at once: their colours stay as far apart as possible for normal vision, for protanopia, deuteranopia and tritanopia, and for grayscale vision.

Distance means perceived difference, measured with the CIEDE2000 formula (ΔE00). A palette is as good as its weakest pair: the quality of a palette is the smallest difference between any two of its colours, in whichever vision makes it smallest. A difference of about 2 is just noticeable, 10 is clear, 30 is a world apart.

The palettes were first published in 2021. This is a new edition: every step was rebuilt, checked and documented again, and the search now runs on the graphics card.

The collection

SizeBest paletteΔE00SetSearch
CVF02████100.001exact
CVF03██████43.1812exact
CVF04████████35.4512proven
CVF05██████████31.1112proven
CVF06████████████28.4412proof 6 %
CVF07██████████████26.0812local
CVF08████████████████24.3912local
CVF09██████████████████22.2412checked
CVF10████████████████████22.2412local
CVF11██████████████████████20.2812checked
CVF12████████████████████████20.0612checked
CVF13██████████████████████████19.4612checked
CVF14████████████████████████████18.1112checked
CVF15██████████████████████████████17.1612checked
CVF16████████████████████████████████16.3712checked

Each size has a set of palettes, the best first. The last column tells how far the search of each size has got. Exact means that every palette was evaluated, proven that an exhaustive search found nothing better, and proof that such a search is running, with its share done so far. Checked and local palettes were found by local search; checked means that the whole neighbourhood of the best palette was also searched exhaustively.

Click a size for its set, with every palette shown as each vision sees it, and its files: hex codes, a JASC-PAL palette for GIMP, Aseprite and the like, a PNG strip with one pixel per colour, and a report of all the differences. The palettes of a size are named by their rank, from CVF16.01, the best of 16 colours, to CVF16.12.

How a CVF palette is built

Grey first

Grayscale vision is always the bottleneck. When colours turn grey, every colour collapses onto one axis, and with four or more colours the smallest grey difference is far below what any other vision can reach.

So the grey levels of a CVF palette of N colours are fixed first: they are the levels of the GRAYSCALE palette of N greys, the best N greys there are. A grayscale reader sees the best possible palette of its size, whatever colours are chosen afterwards.

Then the colours

Each grey level is shared by tens of thousands of sRGB colours, from 30,000 to 120,000 per level. Within its level, each colour is chosen so that the smallest difference over all pairs, in normal vision and in the three simulated dichromacies, is as large as possible. The four visions count equally.

The first colour is always pure black and the last always pure white. Ties are broken by the next weakest differences, so of two palettes with the same weakest pair the one with stronger second pairs wins.

Three colours leave one free level, and all of its colours are tried. Five colours already have about 6·10¹⁴ combinations.

From four colours on, the search is a local search on the graphics card, restarted many times from random palettes and from small changes of the best palettes found so far. A palette improves by changing one colour at a time while that helps, then two at once, and the best ones finally get an exhaustive check of their whole neighbourhood, with all colours moving together. The colour differences are computed with OpenCL on the GPU, about a thousand times faster than NumPy on one processor core, and 256 palettes descend together so that the card is kept busy.

For three to five colours an exhaustive search proved the result: no palette of 4 colours is better than 35.45, and none of 5 is better than 31.11. For larger sizes the search cannot prove the optimum, it can only make it very likely.

The set of each size

The best palette is not always the one you need, so each size offers alternatives. The candidates are all palettes within 90 % of the best, and from four colours on there are hundreds or thousands of them. Twelve are shown, chosen to be as different from each other as possible: the best comes first, and each next one is the candidate farthest from all those already chosen, measured by the mean difference of their colours in normal vision. So the twelve cover the whole range of good palettes, instead of twelve near copies of the best one.

What changed since 2021

The scores of 2021 and of today were measured with different models, so they are not directly comparable.

The code

The palettes are made by the open-source project cvf-palettes, written in Python with NumPy and Pillow only, and an OpenCL kernel called through ctypes. The repository holds the palette files, the documentation of every step and the tests.

Licence

The palettes are in the public domain under CC0 1.0: use them for anything, with no permission and no credit needed. A mention of the project is welcome all the same. The code of cvf-palettes is under the MIT licence.