Somebody know how can I get the color scheme programatically using a VSPackage in C#?
I know that I can use IVsUIShell5.GetThemedColor
for VS2011, but I don't know how to get it from VS2005, VS2008 or VS2010.
Thanks in advance.
On the menu bar, select Tools > Options. In the options list, select Environment > General. In the Color theme list, choose between the default Dark theme, the Blue theme, the Blue (Extra Contrast) theme, and the Light theme. Or, choose the Use system setting option to select the theme that Windows uses.
VSPackages are software modules that extend the Visual Studio integrated development environment (IDE) by providing UI elements, services, projects, editors, and designers.
There are two ways, using IVSShell and IVSShell2:
private List<Color> GetColorList1()
{
IVsUIShell uiShell = (IVsUIShell)this.GetService(typeof(IVsUIShell));
List<Color> result = new List<Color>();
foreach (VSSYSCOLOR vsSysColor in Enum.GetValues(typeof(VSSYSCOLOR)))
{
uint win32Color;
uiShell.GetVSSysColor(vsSysColor, out win32Color);
Color color = ColorTranslator.FromWin32((int)win32Color);
result.Add(color);
}
return result;
}
private List<Color> GetColorList2()
{
IVsUIShell2 uiShell = (IVsUIShell2)this.GetService(typeof(IVsUIShell2));
List<Color> result = new List<Color>();
foreach (__VSSYSCOLOREX vsSysColor in Enum.GetValues(typeof(__VSSYSCOLOREX)))
{
uint win32Color;
uiShell.GetVSSysColorEx((int)vsSysColor, out win32Color);
Color color = ColorTranslator.FromWin32((int)win32Color);
result.Add(color);
}
return result;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With