3 ms·
> I just took the euclidean distance between the given color and (0,255,0) If you used HSL, you possibly could match on the hue while being more lax on the bri
by aasasd 6y ago
> I just took the euclidean distance between the given color and (0,255,0)
If you used HSL, you possibly could match on the hue while being more lax on the brightness and saturation—so a pastel-pink color could still match to a red image. Not sure if the database can use different weights for positions in a vector (though with pre-processing S and L could be collapsed to narrower ranges, so they match more freely afterwards). Just need to make sure that white and black aren't matched to random hue values.
Though, I guess if you use only the distance to fixed chosen high-saturation values then it's about the same thing.
Except it seems that with just RGB distance, a semi-saturated cyan or yellow color might be counted as closer to ‘pure green’ than dark-green. Something like (0,255,180) vs (0,70,0).
Also:
> values('(${ color })'
2020 and still no placeholders.
- ajnin 6y agoI'm not sure HSL would be better in that case. For unsaturated colors (black to grey to white) HSL has many points that have perceptually the same color but different HSL values. If S is zero, then you have the same color for any value of H so you might get a large distance for two points that are actually white for example. At least when using Cartesian coordinates like he is here.
- aasasd 6y agoYes, as I noted: > Just need to make sure that white and black aren't matched to random hue values. Colors with too small saturation can just be excluded from the search, since gray/white/black go with anything.