Colors Helper

The Colors Helper lets users convert colors from text names, HTML hex, HSV, or HSL to Windows UI Colors (and back again of course).

Example

    // Be sure to include the using at the top of the file:
    //using Microsoft.Toolkit.Uwp;

    // Given an HTML color, lets convert it to a Windows Color
    Windows.UI.Color color = ColorHelper.ToColor("#3a4ab0");

    // Also works with an Alpha code
    Windows.UI.Color myColor = ColorHelper.ToColor("#ff3a4ab0");

    // Given a color name, lets convert it to a Windows Color
    Windows.UI.Color redColor = "Red".ToColor();

You can find more examples in our unit tests

Requirements (Windows 10 Device Family)

Device family Universal, 10.0.10586.0 or higher
Namespace Microsoft.Toolkit.Uwp

API