colors - How to determine if a colour is black or grey? -


i importing text, , have able tell if text either grey or black vs other colour.

is there way determine if given colour black or grey? looked @ relative luminance i'm not sure tells me it's black or grey. i'm spending lot of time fiddling hsv/hsl seem able find exceptions.

currently have

bool isgreyorblack = (c.saturationf() < 0.13 && c.valuef() < 0.40) || (c.saturationf() >= 0.13 && c.lightnessf() < 0.10); 

but doesn't work well.


Comments