ColorHelper.FromArgb(Byte, Byte, Byte, Byte) ColorHelper.FromArgb(Byte, Byte, Byte, Byte) ColorHelper.FromArgb(Byte, Byte, Byte, Byte) ColorHelper.FromArgb(Byte, Byte, Byte, Byte) ColorHelper.FromArgb(Byte, Byte, Byte, Byte) Method

Definition

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)
static Color FromArgb(Byte a, Byte r, Byte g, Byte b) const;
public static Color FromArgb(Byte a, Byte r, Byte g, Byte b)
Public Shared Function FromArgb(a As Byte, r As Byte, g As Byte, b As Byte) As Color
var color = Windows.UI.ColorHelper.fromArgb(a, r, g, b);

Parameters

a
Byte Byte Byte

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

r
Byte Byte Byte

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

g
Byte Byte Byte

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

b
Byte Byte Byte

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

Returns

The generated Color value.

Examples

This example shows how to create a Color.

Windows::UI::Color orangeColor{ Windows::UI::ColorHelper::FromArgb(255, 255, 128, 0) };
auto orangeColor = Windows::UI::ColorHelper::FromArgb(255, 255, 128, 0);

This example shows how to create a SolidColorBrush with the specified Color.

Windows::UI::Xaml::Media::SolidColorBrush greenBrush{
    Windows::UI::ColorHelper::FromArgb(255, 90, 200, 90) };
auto greenBrush = ref new SolidColorBrush(Windows::UI::ColorHelper::FromArgb(255, 90, 200, 90));

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.

See also