I’ve got a chart showing data as a part of a vb.net forms application. The Chart object makes a really pretty picture, but I need it to match the color scheme on the rest of the UI. How do I get the RGB values for the palette?
Debug.Print(Chart1.Palette.Chocolate.WHAT ARE THE RGB COLORS??!)
Edit 1
Note: Chocolate is both the name of a color and the name of a .net Palette The post above refers to Chocolate the Palette, which contains multiple colors.
The struct
System.Drawing.Colorhas static properties with webcolors:This will return color names:
The
ToString()method ofSystem.Drawing.Colorwill return a color name if the color is a known color, otherwise A, R, G, B values:A palette is a selected set of colors. This is a palette:
This is another palette:
Finally I found the answer by using .NET Reflector:
In the
System.Web.UI.DataVisualization.Charting.Utilitiesnamespace there is an internal static classChartPaletteColors. Since it is internal you can’t access it. But reflector shows how the color palettes are initialized. Form this I got the following palettes:The GrayScale palette is determined by:
gray value = 200 - (i * 11)where
iranges from 0 to 15.