Question

I'm writing a Windows application that displays its tray icon on the Windows system tray (next to the system clock). The problem is that my icon looks great on some backgrounds and looks horrible on others. One would solve this issue by creating a shadow or an outline around an icon, but the tray icon is just 16x16 pixels, which makes the former quite difficult to achieve.

So I was curious, is there a way to find out what system tray background is, that my icon is displayed on, as RGBA mean value, for instance? (I understand that it is now not a solid color, thus the word "mean".) And if so, I'm sure there's an algorithm to determine if it's a bright (gray, silver) vs. dark background (blue or black). This will let me load either dark or bright verson of my tray icon.

Was it helpful?

Solution

As you provide an icon only, you don't have an option to paint the area where the icon is supposed to be shown. With Aero off, the color is expected to be GetSysColor(COLOR_BTNFACE), otherwise things are more complicated and transparency involved so that windows underneath the appbar actually affect background color around system tray icon.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top