How does Windows 7 taskbar "color hot-tracking" feature calculate the colour to use?

Posted by theyetiman on Super User See other posts from Super User or by theyetiman
Published on 2014-03-19T09:21:18Z Indexed on 2014/06/03 9:28 UTC
Read the original article Hit count: 248

Filed under:
|
|
|
|

This has intrigued me for quite some time.

Does anyone know the algorithm Windows 7 Aero uses to determine the colour to use as the hot-tracking hover highlight on taskbar buttons for currently-running apps?

Windows 7 taskbar hover colours

It is definitely based on the icon of the app, but I can't see a specific pattern of where it's getting the colour value from.

It doesn't seem to be any of the following:

  1. An average colour value from the entire icon, otherwise you would get brown all the time with multi-coloured icons like Chrome.
  2. The colour used the most in the image, otherwise you'd get yellow for the SQL Server Management Studio icon (6th from left). Also, the Chrome icon used red, green and yellow in equal measure.
  3. A colour located at certain pixel coordinates within the icon, because Chrome is red -indicating the top of the icon - and Notepad++ (2nd from right) is green - indicating the bottom of the icon.

I asked this question on ux.stackoverflow.com and it got closed as off-topic, but someone answered with the following:


As described by Raymond Chen in this MSDN blog article:

Some people ask how it's done. It's really nothing special. The code just looks for the predominant color in the icon. (And, since visual designers are sticklers for this sort of thing, black, white, and shades of gray are not considered "colors" for the purpose of this calculation.)


However I wasn't really satisfied with that answer because it doesn't explain how the "predominant" colour is calculated. Surely on the SQL Management Studio icon, the predominant colour, to my eyes at least, is yellow. Yet the highlight is green. I want to know, specifically, what the algorithm is.

© Super User or respective owner

Related posts about windows-7

Related posts about mouse