Export (0) Print
Expand All

Color Structure

.NET Framework 4.5

Describes a color in terms of alpha, red, green, and blue channels.

Namespace:  Windows.UI
Assembly:  System.Runtime.WindowsRuntime (in System.Runtime.WindowsRuntime.dll)
XMLNS for XAML: Not mapped to an xmlns.

public struct Color : IFormattable
<Color ...>predefinedColor</Color>
- or -
<Color ...>#rgb</Color>
- or -
<Color ...>#argb</Color>
- or -
<Color ...>#rrggbb</Color>
- or -
<Color ...>#aarrggbb</Color>
- or -
<Color ...>sc#scR,scG,scB</Color>
- or -
<Color ...>sc# scA,scR,scG,scB</Color>
<object property="predefinedColor"/>
- or -
<object property="#rgb"/>
- or -
<object property="#argb"/>
- or -
<object property="#rrggbb"/>
- or -
<object property="#aarrggbb"/>
- or -
<object property="sc#scR,scG,scB"/>
- or -
<object property="sc# scA,scR,scG,scB"/>

XAML Values

predefinedColor

One of the colors predefined by the Colors class (static properties), or one of the other named colors. See Remarks.

rgb

A three-character hexadecimal value. The first c specifies the color's R value, the second character specifies the G value, and the third character specifies the B value. For example, 00F.

argb

A four-character hexadecimal value. The first character specifies the color's A value, the second character specifies its R value, the third character specifies the G value, and the fourth character specifies its B value. For example, F00F.

rrggbb

A six-character hexadecimal value. The first two characters specify the color's R value, the next two specify its G value, and the final two specify its B value. For example, 0000FF.

aarrggbb

An eight-character hexadecimal value. The first two characters specify the color's A value, the next two specify its R value, the next two specify its G value, and the final two specify its B value. For example, FF0000FF.

scA

The color's ScA value as a value between 0 and 1. ScA is not exposed as a Color property directly.

scR

The color's ScR value as a value between 0 and 1. ScR is not exposed as a Color property directly

scG

The color's ScG value as a value between 0 and 1. ScG is not exposed as a Color property directly

scB

The color's ScB value as a value between 0 and 1. ScB is not exposed as a Color property directly

The Color type exposes the following members.

  NameDescription
Public propertyAGets or sets the sRGB alpha channel value of the color.
Public propertyBGets or sets the sRGB blue channel value of the color.
Public propertyGGets or sets the sRGB green channel value of the color.
Public propertyRGets or sets the sRGB red channel value of the color.
Top

  NameDescription
Public methodEquals(Color)Tests whether the specified Color structure is identical to the current color.
Public methodEquals(Object)Tests whether the specified object is a Color structure and is equivalent to the current color. (Overrides ValueType.Equals(Object).)
Public methodStatic memberFromArgbCreates a new Color structure by using the specified sRGB alpha channel and color channel values.
Public methodGetHashCodeGets a hash code for the current Color structure. (Overrides ValueType.GetHashCode().)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodToString()Creates a string representation of the color using the ARGB channels in hex notation. (Overrides ValueType.ToString().)
Public methodToString(IFormatProvider)Creates a string representation of the color by using the ARGB channels and the specified format provider.
Top

  NameDescription
Public operatorStatic memberEqualityTests whether two Color structures are identical.
Public operatorStatic memberInequalityTests whether two Color structures are not identical.
Top

  NameDescription
Explicit interface implemetationPrivate methodIFormattable.ToStringInfrastructure. For a description of this member, see ToString.
Top

The XAML object element usage (with initialization text) is useful for declaring a Color as a resource in a XAML ResourceDictionary.

Supported in: Windows Phone Silverlight 8

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft