Closed GoogleCodeExporter closed 8 years ago
Following method is the previous solution we used to judge if a color is dark
or light.
if ($R + $G + $B >= 450) {
// it's light color
}
It's very simple,but not good, especially while the B is very big compared to
others. Considering eyes have different sensitive level to red, blue and gree.
We decide to use YUV mode instead of RBG mode,Y here is the light level,
defined as following:
$grayLevel = $R * 0.299 + $G * 0.587 + $B * 0.114;
if ($grayLevel >= 192) {
// it's a light color
}
-------------------------------------
It's applied on the dialog of "class manager" and the list of annotation text
on result editor.
(The screenshot is attached.)
-------------------------------------
Original comment by jwleng@gmail.com
on 2 Aug 2012 at 8:28
Attachments:
Original comment by jwleng@gmail.com
on 10 Oct 2012 at 6:34
Original issue reported on code.google.com by
jwleng@gmail.com
on 2 Aug 2012 at 8:23