# Why does the chromaticity diagram look like that?

DevFeed: [Why does the chromaticity diagram look like that?](<https://devfeed.tech/articles/why-does-the-chromaticity-diagram-look-like-that-28097.md>)

Original publisher: [Read original article](<https://jlongster.com/why-chromaticity-shape>)

Author: James Long

Published: 2024-01-08T12:00:00Z

Content type: article

Language: en

Sources: [James Long](<https://devfeed.tech/sources/james-long.md>)

Topics: [math](<https://devfeed.tech/topics/math.md>), [pixel](<https://devfeed.tech/topics/pixel.md>)

Tags: [article](<https://devfeed.tech/tags/article.md>), [color](<https://devfeed.tech/tags/color.md>), [image](<https://devfeed.tech/tags/image.md>), [pixel](<https://devfeed.tech/tags/pixel.md>), [rgb](<https://devfeed.tech/tags/rgb.md>), [theory](<https://devfeed.tech/tags/theory.md>)

## AI overview

This article explains why the CIE 1931 chromaticity diagram has its characteristic shape and how its colors are computed. It introduces color-matching functions for red, green, and blue, then describes calculating color mixtures and rendering sampled points into a two-dimensional image.

## Source excerpt

(note: skipping interactive content block) ^30b920 I've always wanted to understand color theory, so I started reading about the XYZ color space which looked like it was the mother of all color spaces. I had no idea what that meant, but it was created in 1931 so studying 93-year old research seemed like a good place to start. When reading about the XYZ color space, this cursed image keeps popping up: By BenRG - Own work based on: CIExy1931.svg, Public Domain, https://commons.wikimedia.org/w/index.php?curid=7889658 I say "cursed" because I have no idea what that means. What the heck is that shape?? I couldn't find any reasonably clear answer to my question. It's obviously not a formula like x = func(y). Why is it that shape, and where did the colors come from? Obviously the edges are wavelengths which have a specific color, but how did the image above compute every pixel? I became obsessed with this question. Below is the path I took to try to answer it. I'll spoil the answer but it might not make sense until you read this article: the shape comes from how our eyes perceive red, green, and blue relative to each other. Skip to the last section if you want to see some direct examples. The fill colors inside the shape are another story, but a simple explanation is there is some math to calculate the mixture of colors and we can draw the above by sampling millions of points in the space and rendering them onto the 2d image. Let's dig in more. (note: skipping interactive content block) ^f0af28 (note: skipping interactive content block) ^82e29b Color matching functions The first place to start is color matching functions. These functions determine the strength of specific wavelengths (color) to contribute so that our eyes perceive a target wavelength (color). We have 3 color matching functions for red, green, and blue (at wavelengths 700, 546, and 435 respectively), and these functions specify how to mix RGB to so that we visually see a spectral color. More simply put: ima