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?
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:
- An average colour value from the entire icon, otherwise you would get brown
all the timewith multi-coloured icons like Chrome.
- 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.
- 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.