Home All Groups Group Topic Archive Search About

Is one color brighter than the other one?

Author
11 Mar 2009 12:02 PM
Ulf Christenson
Hello!

In my application (it's a very graphic related application for children)
the user can set the colors of the buttons by himself.
The user can set two colors which will fade into each other from top to
bottom. My initial idea was that the upper color should be brighter than
the lower color, as you can see it all controls from MS.
But most people do not know or get it, and the always switch the colors,
and the buttons look like they're pressed (pressed buttons have their
darker color on top and the brighter color on bottom, while it is just
the other way around in their "normal" state).
Now I am trying to automatically switch it if it's wrong.
Does anybody know if it's possible to say if one color is brighter than
the other one?

Ulf

Author
11 Mar 2009 12:50 PM
Clive Lumb
"Ulf Christenson" <u.christen***@googlemail.com> a écrit dans le message de
news: %23s%23jkFkoJHA.3***@TK2MSFTNGP05.phx.gbl...
Show quoteHide quote
> Hello!
>
> In my application (it's a very graphic related application for children)
> the user can set the colors of the buttons by himself.
> The user can set two colors which will fade into each other from top to
> bottom. My initial idea was that the upper color should be brighter than
> the lower color, as you can see it all controls from MS.
> But most people do not know or get it, and the always switch the colors,
> and the buttons look like they're pressed (pressed buttons have their
> darker color on top and the brighter color on bottom, while it is just the
> other way around in their "normal" state).
> Now I am trying to automatically switch it if it's wrong.
> Does anybody know if it's possible to say if one color is brighter than
> the other one?
>
> Ulf

Off the top of my head I would suggest comparing the sum of their RGB
components.
Author
11 Mar 2009 12:52 PM
Jim Mack
Ulf Christenson wrote:
> Hello!
>
> Does anybody know if it's possible to say if one color
> is brighter than the other one?

It's somewhat subjective, but much less so if you're comparing two
shades of the same basic color.

Assuming you have the BGR values for the two colors:

Luma& = (B * 11&) + (G * 59&) + (R * 30&)

Whichever color has the higher Luma value is brighter.

This is a shorthand way of getting the 'standard' luminance value.
You'll find different sets of weightings for different color systems
and schemes, but this one (NTSC) works just fine.

--
   Jim Mack
   Twisted tees at http://www.cafepress.com/2050inc
   "We sew confusion"
Author
11 Mar 2009 3:16 PM
Eduardo
I use:

Public Function ColorApparentBrightness(nColor As Long) As Long
    Dim iR As Long
    Dim iG As Long
    Dim iB As Long

    iR = nColor And 255
    iG = (nColor \ 256) And 255
    iB = (nColor \ 65536) And 255

    ColorApparentBrightness = iR * 0.2126 + iG * 0.7152 + iB * 0.0722
End Function


Show quoteHide quote
"Ulf Christenson" <u.christen***@googlemail.com> escribió en el mensaje
news:%23s%23jkFkoJHA.3572@TK2MSFTNGP05.phx.gbl...
> Hello!
>
> In my application (it's a very graphic related application for children)
> the user can set the colors of the buttons by himself.
> The user can set two colors which will fade into each other from top to
> bottom. My initial idea was that the upper color should be brighter than
> the lower color, as you can see it all controls from MS.
> But most people do not know or get it, and the always switch the colors,
> and the buttons look like they're pressed (pressed buttons have their
> darker color on top and the brighter color on bottom, while it is just the
> other way around in their "normal" state).
> Now I am trying to automatically switch it if it's wrong.
> Does anybody know if it's possible to say if one color is brighter than
> the other one?
>
> Ulf
Author
11 Mar 2009 3:53 PM
Nobody
"Eduardo" <m*@mm.com> wrote in message news:gp8kje$2ra$1@aioe.org...
>    ColorApparentBrightness = iR * 0.2126 + iG * 0.7152 + iB * 0.0722

http://en.wikipedia.org/wiki/Luminance_(relative)
Author
11 Mar 2009 5:01 PM
Ulf Christenson
Thank you very much!
Ulf
Author
11 Mar 2009 3:25 PM
mayayana
> In my application (it's a very graphic related application for children)
> the user can set the colors of the buttons by himself.
> The user can set two colors which will fade into each other from top to
> bottom. My initial idea was that the upper color should be brighter than
> the lower color, as you can see it all controls from MS.
> But most people do not know or get it, and the always switch the colors,
> and the buttons look like they're pressed (pressed buttons have their
> darker color on top and the brighter color on bottom, while it is just
> the other way around in their "normal" state).
> Now I am trying to automatically switch it if it's wrong.

   I wonder about that assumption. I know you didn't
ask for opinions about it, but you describe a creative
graphic program for children. Shouldn't they be able to
do it "wrong" and discover for themselves the aesthetics
of color? Maybe they'll prefer the bottom-lit effect. (A 6
year old boy might prefer to have his GUI look vaguely
sinister, like an alien spaceship console.) Or maybe after
a couple of days they'll decide they don't like that look
and will reverse the colors, having learned something about
how 3-d simulation works, and/or having grokked a bit more
about the emotional/vibrational effects of colors.

   ...Just a thought. I don't know from your description what
purpose the program is intended to serve.

Show quoteHide quote
> Does anybody know if it's possible to say if one color is brighter than
> the other one?
>
> Ulf