Class ColorDefinitions
- Namespace
- Tudormobile.Wpf.Controls
- Assembly
- Tudormobile.WpfControls.dll
Provides static color definitions and utilities for parsing HTML color strings.
public static class ColorDefinitions
- Inheritance
-
ColorDefinitions
- Inherited Members
Remarks
This class contains predefined color palettes organized into harmonious groups and utility methods for converting HTML/CSS-style color strings to WPF Color objects. The color groups are designed to provide aesthetically pleasing color combinations for data visualization.
Fields
ColorGroups
Gets a collection of predefined color groups, each containing harmonious color shades.
public static readonly Color[][] ColorGroups
Field Value
- Color[][]
Remarks
Each group contains six related color shades ranging from light to dark, designed to work well together in charts, graphs, and other data visualizations. The groups include:
- Green Shades - Natural, growth-oriented colors
- Purple Shades - Creative, sophisticated colors
- Orange Shades - Energetic, warm colors
- Blue Shades - Professional, trustworthy colors
- Tan Shades - Neutral, earthy colors
- Aquamarine Shades - Fresh, calming colors
- Rose Shades - Soft, elegant colors
- Turquoise Shades - Vibrant, modern colors
Each color array contains six shades: a base color, followed by progressively lighter and darker variations to provide visual hierarchy and contrast in data presentations.
Methods
FromHtml(string)
Converts an HTML color string to a WPF Color object.
public static Color FromHtml(string htmlColor)
Parameters
htmlColorstringThe HTML color string in RGB or ARGB format (e.g., "#FF0000" or "#80FF0000").
Returns
Examples
var red = ColorDefinitions.FromHtml("#FF0000");
var semiTransparentBlue = ColorDefinitions.FromHtml("#8000FF00");
Remarks
Supports both 6-character RGB format (#RRGGBB) and 8-character ARGB format (#AARRGGBB). The leading '#' character is optional. If the alpha channel is not specified, it defaults to 255 (fully opaque).
Exceptions
- FormatException
Thrown when the input string is not a valid hexadecimal color format.