Intersect the number of a color spread according to selected color

hello,
I would like to know the index of a 40 spreads color box wich is the closer than a picked color (thanks to pipet).
Intersect does such like that, but I can’t convert values from color in a proper way to be intersect correctly (epsilon is just a great feature on this object).
working with wavelenght coulb be a good solution (this shows you a c program to convert rgb to wavelenght http://miguelmoreno.net/sandbox/wavelengthtoRGB/ )
but for my little beguiner level it would be complicated, wand there must be some easiest way to do this ?
here’s the patch to understand what I mean:
thx

getspread_position_color.v4p (24.4 kB)

https://discourse.vvvv.org/t/5393 may help (try the solution provided by @tonfilm).

hello, colors are just vectors in 3d (RGB) or 4d (RGBA) space. take a RGB split and calc the difference vector between the colors and the color you are looking for. the shortest vector is your hit.

getspread_position_color_0.v4p (24.0 kB)

schneller als sein schatten :)

beautiful !
I’m from max msp, and i have to learn the vvvv logical, but without yet understanding, I love it !!
is this possible to include some tolerance in the chain ? to get the closer spread of the picked color ?

thx

the first few indices of the Sort are the closest colors. so instead of the CAR you could use a GetSpread with the number of colors you like to get.