Visual Studio VSPackage 图标显示不同的颜色

Visual Studio VSPackage icon displays different colors

我正在尝试为激活我的自定义 VSPackage 扩展的按钮提供一个图标。

设计图标时,使用了以下颜色:

前景:#fff(白色) 背景:#a375e7(淡紫色)

在 Visual Studio(解决方案资源管理器,顶部)中的按钮中显示图标时,会看到以下颜色:

前景:#000(黑色) 背景:#5c1fb7(深紫色)

图标禁用。

该图标来自一个包含多个图标的 PNG 文件。每个图标都是 16 x 16 像素。

诚然,我不是图像处理方面的专家,所以我有根据的猜测是在导出之前的设计时图像设置很简单。

有什么想法吗?

In order to make icons appear with the correct contrast ratio in the Visual Studio dark theme, an inversion is applied programmatically.

请参阅 图像和图标中的 Color inversion for dark themes Visual Studio 文档。

要退出反转,您可以尝试将右上角像素设置为青色 (#00FFFF)。来自 IVsImageService2.ThemeDIBits 文档:

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.