ColorHelper ColorHelper ColorHelper ColorHelper Class

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

Syntax

Declaration

public sealed class ColorHelperpublic sealed class ColorHelperPublic NotInheritable Class ColorHelperpublic sealed class ColorHelper

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 summary

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

Prerelease. Retrieves the display name of the specified color.

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 Colorpublic static Color FromArgb(Byte a, Byte r, Byte g, Byte b)

    Parameters

    • a
      System.Byte
      System.Byte
      System.Byte
      System.Byte

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

    • r
      System.Byte
      System.Byte
      System.Byte
      System.Byte

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

    • g
      System.Byte
      System.Byte
      System.Byte
      System.Byte

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

    • b
      System.Byte
      System.Byte
      System.Byte
      System.Byte

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

    Returns

    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 @Windows.UI.Xaml.Media.SolidColorBrush.#ctor(Windows.UI.Color) constructor, then assign that brush to a XAML UI property.

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

    Prerelease. Retrieves the display name of the specified color.

    public static string ToDisplayName(Color color)public static string ToDisplayName(Color color)Public Static Function ToDisplayName(color As Color) As stringpublic static string ToDisplayName(Color color)

    Parameters

    Returns

    • string
      string
      string
      string

      The localized display name of the color.

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.MarshalingBehaviorAttribute
Windows.Foundation.Metadata.StaticAttribute
Windows.Foundation.Metadata.StaticAttribute
Windows.Foundation.Metadata.ThreadingAttribute

Details

Assembly

Windows.UI.dll