# What would be the correct way to calculate saturation in this case?

I'm trying to make a HSV representation of the xyY color space. To calculate hue from an $(x, y)$ color, I use the angle between that color and red (wavelength 745) on the xy chromacity diagram, with white $(\frac{1}{3}, \frac{1}{3})$ as the center.

The saturation is the ratio between the distance between white and $(x, y)$, and white and a fully-saturated version of $(x, y)$ (which is the intersection between the line between $(\frac{1}{3}, \frac{1}{3})$ and $(x, y)$ and the edge of the chromacity diagram).

xy chromacity diagram:

The problem that I'm having is that when I plot my color space (at value=1) and compare it to the HSV representation of RGB, the saturation (distance from center) doesn't seem to match how "colorful" the color actually is:

My color space (saturation seems wrong):

HSV color space of RGB:

How should I calculate saturation instead?

• I think you should add more details about how you actually created your color palette/table so users might be able to help you. You might also consider one of the computer science-based Stack Exchanges. – honeste_vivere Nov 19 '15 at 20:29

There is unfortunately no good answer to this question. Simply it wont work. There is no good way to define colorful, it this context. Cie is trying to capture the physical measurement. It however does not succeed very well in relating the colors to each other.

Colors on the very outer arc represent spectral distributions of close to Dirac delta function. So one could construct a model that says that a color is very colorful when it is a Dirac delta.

There is a unforeseen consequence of this definition though. Namely the magenta colors do not exist as Dirac Deltas. As these colors do not exist in the spectrum. So they consist of mixture of 2 wavelengths only. This would mean they are less colorful than most other colors.

## Other problems

Unfortunately, xyY is not perceptually uniform. So a straight line on the xyY does not represent interpolations between 2 color mixtures. Therefore making a polar transformation means you will have different color bases on same coordinates. Also precieved color do not really move over to your model. To do this properly you would need to do a extremely sophisticated transformation.

There are many problems with converting color to a polar coordinates in that that is exactly contrary how vision works. White is also a bit problematic in this context. The distance to full saturated signal is different for each of the 3 different cones in the eye. Hell, even what is while depends on the surrounding colors and ambient color conditions. So aim afraid your trying to force a worldview that does not exist.

## Finally

What would this be useful for?

• xyY is indeed linear, normalized. – troy_s Mar 4 '18 at 18:38
• @troy_s Its energetically linear, but its not linear in percieved color distance. Its just really hard to make a space that is uniform in perceptual distance between 2 points. – joojaa Mar 4 '18 at 20:51
• Perceptually uniform is a far better term than "linear". There is already enough stupidity around that term. – troy_s Mar 5 '18 at 21:51
• @troy_s Right, good name for it, changed. I was actually sitting here after answering and thinking asking a question on mathematics ehat would be the minimum requirement for linear. So as to check would linear ever eeven qualify for color. – joojaa Mar 6 '18 at 5:38

The XYZ and xyY models are extremely useful for certain operations such as manipulating RGB colour spaces to another RGB encoded colour space.

However, XYZ and xyY fail quite quickly in other contexts. For example, consider MacAdams ellipses that describe noticeable differences on the linear xyY scale. You could in fact apply a nonlinear, perceptually uniform transform to the xyY values and you'd likely end up closer to what you are hoping for in your circular interface element.

With that being said, there are needs for models that extend and build upon xyY / XYZ to tackle the psychophysical aspect of colour for evaluating such things as "colourfulness". This enters into the domain of Colour Appearance Models, which are capable of accurately modelling and predicting various issues surrounding brightness (luminance), lightness, colorfulness, chroma, saturation, and hue. To achieve what you are seeking, you would need to transform your data into a colour appearance model such as CIECAM02.

The problems cited in the other solution are in fact solved by colour appearance models such as the CIECAM02 model, including psychophysical effects that manifest as optical illusions.