- Highlight Color Algorythm
- Posted by Jeff on March 4th, 2004
If you select icons on the desktop, they change color to highlight the
selection. Does anyone know how Windows maps the unselected colors into the
selected ones? Here is a table of what I have observed so far. Across the
top are the colors being represented. The numbers are the RGB values that
comprise the colors. Unselected and selected are the RGB values for the
colors in an icon when it is not selected and when it is.
Color
White
Black
Red
Yellow
Blue
Green
Unselected
Red
255
0
255
255
0
0
Green
255
0
0
255
0
132
Blue
255
0
0
0
255
0
Selected
Red
123
0
123
123
0
0
Green
140
16
16
140
16
82
Blue
173
49
49
49
173
49
I don't see a pattern in this. I would like to be able to take an arbitrary
RGB value and convert it into its corresponding selected-state color. Is
there a Win32 or MFC call that makes this conversion? I know I could reverse
the colors but I want my application to match the Windows style more closely
than that.
Thanks for the help.
Jeff Walker
jwalkerATumichDOTedu
jeffwaaATaolDOTcom
- Posted by Tim Robinson on March 4th, 2004
Jeff wrote:
[...]
Look at the ImageList_Draw function. This is what controls use to draw icons
in selected (shaded blue) and hidden (shaded white) states.
The algorithm this function uses is to blend pixels in the image 50% with
the system highlight colour. That is, it calculates the average of the red,
green and blue of each source pixel and GetSysColor(COLOR_HIGHLIGHT) and
uses that to draw. But if you use ImageList_Draw, you don't need to worry
about that.
--
Tim Robinson (MVP, Windows SDK)
http://mobius.sourceforge.net/
- Highlight in Excel When I Use High Contrast Black Windows Color Sc (Microsoft Windows) by montgomerymouse
- AIO color & BW print, color & BW copy, pcfax, color scan (Printers) by A. L. Shaw, MD
- OE6.0 Message Rules - Highlight with Color (Computers & Technology) by John R. Baker
- Word-text select highlight color change? (Home and office) by Matthew
- rsa algorythm in asp (Programming) by Krzyso

