ColorHelper.

ColorFromString(string) Method

Summary

This function tries to convert a given string into a Color in the following order: 1. If the string starts with '#' the function tries to get the color from the hex-code 2. else the function tries to find the color in the default ColorNamesDictionary 3. If 1. + 2. were not successful the function adds a '#' sign and tries 1. + 2. again
Namespace
MahApps.Metro.Controls
Containing Type
ColorHelper

Syntax

public static Color? ColorFromString(string colorName)

Parameters

Name Type Description
colorName string The localized name of the color, the hex-code of the color or the internal color name

Return Value

Type Description
Color? the Color if successful, else null