Inclusive Color Space - Algorithm for diverse skin tones
Show HN: Simple algorithm and color space to generate diverse skin tones

Inclusive Color Space is a project that defines a mathematical color space specifically for generating diverse, plausible human skin tones. It provides a simple algorithm and a custom color picker, making it easy for developers and digital artists to create inclusive character creators, art, and other tools. The project uses PCA and a sphere-to-RGB mapping to cover a wide range of skin tones, addressing the limitations of existing preset palettes. It includes JavaScript and Python implementations, and the math is open for anyone to use.
The goal of this work is to identify the broadest inclusive range of colors in the RGB color space that correspond to plausible, but simplified skin tones.
- vermarish
This is beautiful work! First, I thought this would involve using PCA to go from 3D to 2D, which would result in an easier selector to use, but at the expense of representing every person.
Then, I thought this would stop at using the U-space vectors (the ones that form the basis of the PCA image) and their corresponding ellipse to form our color space, but no, the function fitting is a very slick idea, even if it was executed by hand.
Lastly, I love the presentation of sampling from different r values. Whether you sample from a fixed r value or a range of r values, I bet this has great applications in game design or animation.
I still don't quite get the manual data labeling process at the beginning? It seems like it would encode some bias, but the consistency of the first point cloud and the results certainly speak for themselves.
- s1mon
It's always entertaining to try to understand these things from first principles. Color and skin color in particular are very complex things to measure and model. It's not just a physical quantity, it's also a matter of human perception based on lighting and a host of factors.
It seems like some work was done to research existing approaches, but I don't see any reference to Pantone Skin Tones [0]. Without intending to, I've worked on 3 different projects which involved measuring skin tones for makeup applications. The Pantone range is not 100% perfect, but it's pretty well done and easy to understand. There are two axes: a light/dark one, and red-yellow one [1].
[0] https://www.pantone.com/na/en-us/skintone
[1] https://cosmeticsbusiness.com/pantone-skintone-guide-80945
- herf
This seems to do XYZ->RGB without any gamma correction. XYZ is linear, as is the transform to RGB, so we usually convert linear RGB to (gamma-encoded) sRGB at the end.
The JS code seems to output linear RGB directly to the webpage (missing gamma). I guess the difficulty with "adding gamma" to it is this: if the training data were also gamma encoded, then it might need to be refit with linear values.
- dahart
> What colors are we? The short answer is maybe something like “brown” and the long answer is very, very long.
Pete Shirley (author of Ray Tracing In One Weekend) is also a part time color scientist, and he clued me into the fact that if you crank the saturation to 100% of pictures of people of any race, the skin color comes out orange. I think I heard that some face detectors may work on this principle, but I don’t remember where I heard that.
- mbo
Love it!
I was looking at this a little while ago, and used some of The Pudding's data on makeup/foundation shades (https://pudding.cool/2018/06/makeup-shades/) and plotted it into the Oklab colorspace (https://observablehq.com/@55th/foundation-shades). The shades form themselves into that same crescent as seen in the article.
- andai
Nice. Most of these colors look right to me, but I'm also seeing green, blue and purple? If you're curating colors from the space manually then it's not a problem.
"Only realistic colors" would be a different problem. And I'm not sure if there's a way to solve that problem without excluding some real colors too.
(Maybe if the colour selector was a different shape? I don't know much about color spaces.)
- stephantul
Love it. I especially thought the introspective “aside” section on related resources was great, and I wish more people would show this kind of reflection.
- dofm
Interesting though that the 1.5 setting (at least on my older iPhone) doesn’t really ever seem to cover the range of skin tones of indigenous Australians (“aboriginal” and Torres Strait Islanders), who apparently get their skin tones from a somewhat different expression of genes than other peoples with darker skin.
The 2.0 “outliers” cover those skin tones.
Masai and some Somali skin tones, similarly, look better represented by the outliers.
The full range of possible human skin tones is perhaps a bit of a challenge for technical colour representation, partly because diffuse reflectance seems to vary so much and that is hard to approximate on screen (e.g. as any website designer could attest, the difference between representing silver and grey is the use of highlights), though the representation of skin tones is a lot better than the early colour film era.