ColorHelper ColorHelper ColorHelper ColorHelper Class

Definition

Provides static helper methods for processing Color values. C# and Microsoft Visual Basic code should use methods of Color instead.

public : sealed class ColorHelper : IColorHelperpublic sealed class ColorHelper : IColorHelperPublic NotInheritable Class ColorHelper Implements IColorHelper// You can use this class in JavaScript.
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

Color is a Windows Runtime structure that represents a color that has four channels: A (alpha), R (red), G (green), B (blue). Each of the values is stored as a Byte type with value 0-255. The most frequent application of Color is to define color-related properties in a UI element as part of a Windows Store app using C++, C#, or Visual Basic and its XAML UI definition.

ColorHelper is one of several Helper classes that are intended to provide utility methods for Windows Runtime structure values. C# and Microsoft Visual Basic code can use methods of Color instead, because utility methods are available directly on the structure due to .NET Framework runtime support. C++ code including Visual C++ component extensions (C++/CX) can only access the data values on Color, for example the A field value. For C++ developers, some of the utility features that C# and Microsoft Visual Basic can use directly on Color as nondata members are available from the ColorHelper class.

Methods

FromArgb(Byte, Byte, Byte, Byte) FromArgb(Byte, Byte, Byte, Byte) FromArgb(Byte, Byte, Byte, Byte) FromArgb(Byte, Byte, Byte, Byte)

Generates a Color structure, based on discrete Byte values for ARGB components. C# and Microsoft Visual Basic code should use Color.FromArgb instead.

public : static Color FromArgb(Byte a, Byte r, Byte g, Byte b)public static Color FromArgb(Byte a, Byte r, Byte g, Byte b)Public Static Function FromArgb(a As Byte, r As Byte, g As Byte, b As Byte) As Color// You can use this method in JavaScript.
Parameters
a
Byte Byte Byte Byte

The A (transparency) component of the desired color. Range is 0-255.

r
Byte Byte Byte Byte

The R component of the desired color. Range is 0-255.

g
Byte Byte Byte Byte

The G component of the desired color. Range is 0-255.

b
Byte Byte Byte Byte

The B component of the desired color. Range is 0-255.

Returns

The generated Color value.

Remarks

C#/Visual Basic The ColorHelper class is available for use from C# and Visual Basic code but it's not commonly used. The FromArgb method that's available as a static method of the Color structure has exactly the same functionality, and you also have other API there that's more convenient to use from Color itself rather than using the ColorHelper class. ColorHelper is mainly intended for Visual C++ component extensions (C++/CX) code, which doesn't have access to the nondata API of the Color structure.

The most common reason for creating a Color value is to use it as an argument for the SolidColorBrush constructor, then assign that brush to a XAML UI property.

ToDisplayName(Color) ToDisplayName(Color) ToDisplayName(Color) ToDisplayName(Color)

Retrieves the display name of the specified color.

public : static PlatForm::String ToDisplayName(Color color)public static string ToDisplayName(Color color)Public Static Function ToDisplayName(color As Color) As string// You can use this method in JavaScript.
Parameters
color
Color Color Color Color

The color to get the name for.

Returns
PlatForm::String string string string

The localized display name of the color.

Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)

See Also