Reputation: 7783
I am trying to provide an icon for the button that activates my custom VSPackage extension.
When designing the icon, the following colors are used:
Foreground: #fff (white) Background: #a375e7 (light purple)
When displaying the icon in the button within Visual Studio (Solution Explorer, top), the following colors are seen:
Foreground: #000 (black) Background: #5c1fb7 (dark purple)
The icon is not disabled.
The icon comes from a PNG file with multiple icons in it. Each icon is 16 x 16 pixels.
Admittedly, I am not an expert on image manipulation so my educated guess is it's something simple concerning image settings at design time, prior to export.
Any ideas?
Upvotes: 1
Views: 515
Reputation: 27900
In order to make icons appear with the correct contrast ratio in the Visual Studio dark theme, an inversion is applied programmatically.
See Color inversion for dark themes in Images and Icons for Visual Studio documentation.
To opt-out from the inversion, you can try to set top-right pixel to cyan (#00FFFF). From IVsImageService2.ThemeDIBits documentation:
Applies theming to BGRA32 device-independent bitmap bits. The luminosity of the image is transformed so that the constant "halo" luminosity blends in with the background. This has the effect of eliminating the halo visually. The "halo" luminosity is an immutable constant, and is not calculated from the input image. Images which contain cyan (#00FFFF) in their top-right pixel are not inverted. Instead, the top-right pixel is cleared (RGBA are all set to 0) and S_OK is returned without otherwise modifying the image.
Upvotes: 2