Windows Dev Center

ColorHelper.FromArgb | fromArgb method

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

Syntax


var color = Windows.UI.ColorHelper.fromArgb(a, r, g, b);

Parameters

a

Type: Number [JavaScript] | System.Byte [.NET] | uint8 [C++]

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

r

Type: Number [JavaScript] | System.Byte [.NET] | uint8 [C++]

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

g

Type: Number [JavaScript] | System.Byte [.NET] | uint8 [C++]

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

b

Type: Number [JavaScript] | System.Byte [.NET] | uint8 [C++]

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

Return value

Type: Color

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.

Requirements (device family)

Device family

Universal

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.UI
Windows::UI [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (operating system)

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Namespace

Windows.UI
Windows::UI [C++]

Metadata

Windows.winmd

See also

ColorHelper
SolidColorBrush

 

 

Show:
© 2015 Microsoft