11

Can anyone explain how to calculate the highlight color based on dominant color in images like Windows-7 taskbar when mouse is over the taskbar item? Any c# code?

images of windows7 taskbar item on mouse hover

Peter O.
  • 32,158
  • 14
  • 82
  • 96
Navid Rahmani
  • 7,848
  • 9
  • 39
  • 57
  • You mean the highlight colour when you wave your mouse over the icon? It's based on the colours in your icon, not counting any overlays. If you don't like it, you need to mess a bit with your icon. – Kate Gregory Jun 15 '11 at 16:32
  • 4
    For the record, this is called color hot-tracking. – BoltClock Jun 15 '11 at 16:39
  • 3
    Color hot-tracking is discussed in the Windows 7 Engineering blog http://blogs.msdn.com/b/e7/archive/2008/11/20/happy-anniversary-windows-on-the-evolution-of-the-taskbar.aspx – sourcenouveau Aug 29 '11 at 21:28

1 Answers1

8

I believe what it does is take the most prominent color in the application's icon using a method similar to this: Python - Find dominant/most common color in an image

With that information, it then applies a translucent radial gradient hue and positions it based on your mouse location. The gradient is more white toward the center of your mouse, but the center is actually off screen. The closer to the actual taskbar item, the more transparent it becomes.

Community
  • 1
  • 1
Jordan
  • 31,971
  • 6
  • 56
  • 67
  • 1
    I've just been playing. The vertical position of your mouse over the icon doesn't change the position of the gradient, but the horizontal position does. At least when you're on large icons and showing labels, as I am. Also I believe white and black are discarded when determining the colour to use. – Kate Gregory Jun 15 '11 at 16:47
  • 1
    @Kate yup you're right about it being horizontal position only. I have noticed some strange behaviour on several icons where it doesn't seem to get the color quite right, but I don't have enough information to make a judgment as to why that is. – Jordan Jun 15 '11 at 21:28
  • I can't understand this python code can you explain it a little psuedo code is better – Navid Rahmani Jun 16 '11 at 09:49