Bravo! I love color and color spaces.
I've been researching the way classic Macs quantize colors to limited palettes:
https://rezmason.net/retrospectrum/color-cube
This cube is the "inverse table" used to map colors to a palette. The animated regions are tints and shades of pure red, green, and blue. Ideally, this cube would be a voronoi diagram, but that would be prohibitively expensive for Macs of the late eighties. Instead, they mapped the palette colors to indices into the table, and expanded the regions assigned to those colors via a simultaneous flood fill, like if you clicked the Paint Bucket tool with multiple colors in multiple places at the same time. Except in 3D.