This question might sound a little bit broad, but how can I estimate the clarity of a rgb color?
I'm trying to create a function f(rgb) that returns 0 if the rgb is black (0,0,0), 1 if it is white (1,1,1) and something in between for other rgb colors.
What I'm trying is this:
f(rgb) = min(rgb) + c1r + c2g + c3b
First I take the minimum value of the rgb channels, then I add it with the products between each channel and a predefined constant.
Example: rgb = (0.4, 0.8, 0.5)
f(rgb) = min(0.4, 0.8, 0.5) + 0.4 c1 + 0.8 c2 + 0.5 c3
f(rgb) = 0.4 + 0.4 c1 + 0.8 c2 + 0.5 c3
But obviously I don't know the values of the constants, I would have to test them manually.
This is why I'm asking if there is a way already.
Got an idea: convert the color to grayscale.
Here I could find an algorithm that does that:
f(rgb) = 0.299r + 0.587g + 0.114b