A few years ago, in my long-lost copy of Charles Petzold's Charles 3.0 programming book, the magical COLORREF or RGB value appeared, which you could use to check whether you want to draw text in light or dark color. For example. if the background color was below this value, then use black text; if it was higher, use white text. Does anyone know / remember that this is a magical meaning?
I can not say about COLORREF, but I have good results using brightness as a threshold:
Y= 0.3 * R + 0.59 * G + 0.11 * B
, 0.0 1.0.
Y >= 0,5, "" ( ), Y < 0,5 .
, , :
L = (R+G+B)/3
. , Green , , .