ff8mania
ff8mania

Reputation: 1760

Discover the real color behind EnvironmentColors

I'm developing a visual studio isolated shell application and I need to know the colors associated to every property of the class EnvironmentColors. Unfortunately every property seems to be a key to a sort of dictionary or something similar. Any idea to get the color associated?

Thanks!

Upvotes: 2

Views: 458

Answers (3)

Jim W
Jim W

Reputation: 5016

I wrote a blog post based on this question because I didn't see how the top voted answer addressed it. There was still the question of; what colour is property XYZ in theme A?

The blog has a (massive, but manageable) image of all the colours, for 3 themes. Snippet of the swatch I would love to upload it here but the file is 3.6MB and there's a 2MB limit, also it is about 40K pixels in height, so that might not be welcome inline!

Upvotes: 4

Sergey Vlasov
Sergey Vlasov

Reputation: 27880

EnvironmentColors are for direct binding to your WPF controls. To get the current value of a theme color in VS 2012+ you can use IVsUIShell5.GetThemedColor (should be re-read on theme changes).

Upvotes: 3

GenXdev
GenXdev

Reputation: 35

foreach (var ColorProperty in typeof(System.Drawing.SystemColors).GetProperties())
{
    var Color = (System.Drawing.Color) ColorProperty.GetValue(null, null);

    Console.WriteLine("{0}, R={1}, G={2}, B={3}", ColorProperty.Name, Color.R, Color.G, Color.B);
}

Upvotes: -3

Related Questions