Pseudo code for a P3 color space chooser?

Hello,


Before I grind this out, I'm wondering has anyone created something like this. Most code I've seen uses boring arrays or a circle, I'd like to use the CIE 1931 color space chromaticity diagram. as a color picker.


1. detect the device color space available P3 or not

2. have a slick and fast way draw the color space, like a perl one-liner but in swift


Thanks