Struct
Color

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

Definition

Namespace:Telerik.WinControls.RichTextEditor.UI

Assembly:Telerik.WinControls.RichTextEditor.dll

Syntax:

cs-api-definition
[TypeConverter(typeof(WpfColorConverter))]
public struct Color : IFormattable

Implements: IFormattable

Properties

A

Gets or sets the sRGB alpha channel value of the color.

Declaration

cs-api-definition
public byte A { get; set; }

Property Value

byte

The sRGB alpha channel value of the color.

B

Gets or sets the sRGB blue channel value of the color.

Declaration

cs-api-definition
public byte B { get; set; }

Property Value

byte

The sRGB blue channel value of the current Color structure.

G

Gets or sets the sRGB green channel value of the color.

Declaration

cs-api-definition
public byte G { get; set; }

Property Value

byte

The sRGB green channel value of the current Color structure.

R

Gets or sets the sRGB red channel value of the color.

Declaration

cs-api-definition
public byte R { get; set; }

Property Value

byte

The sRGB red channel value of the current Color structure.

ScA

Gets or sets the ScRGB alpha channel value of the color.

Declaration

cs-api-definition
public float ScA { get; set; }

Property Value

float

The ScRGB alpha channel value of the current Color structure.

ScB

Gets or sets the ScRGB blue channel value of the color.

Declaration

cs-api-definition
public float ScB { get; set; }

Property Value

float

The ScRGB red channel value of the current Color structure.

ScG

Gets or sets the ScRGB green channel value of the color.

Declaration

cs-api-definition
public float ScG { get; set; }

Property Value

float

The ScRGB green channel value of the current Color structure.

ScR

Gets or sets the ScRGB red channel value of the color.

Declaration

cs-api-definition
public float ScR { get; set; }

Property Value

float

The ScRGB red channel value of the current Color structure.

Methods

AreClose(Color, Color)

Compares two Color structures for fuzzy equality.

Declaration

cs-api-definition
public static bool AreClose(Color color1, Color color2)

Parameters

color1

Color

The first color to compare.

color2

Color

The second color to compare.

Returns

bool

true if color1 and color2 are nearly identical; otherwise, false.

Clamp()

Sets the ScRGB channels of the color to within the gamut of 0 to 1, if they are outside that range.

Declaration

cs-api-definition
public void Clamp()

Equals(Color)

Tests whether the specified Color structure is identical to the current color.

Declaration

cs-api-definition
public bool Equals(Color color)

Parameters

color

Color

The Color structure to compare to the current Color structure.

Returns

bool

true if the specified Color structure is identical to the current Color structure; otherwise, false.

Equals(Color, Color)

Tests whether two Color structures are identical.

Declaration

cs-api-definition
public static bool Equals(Color color1, Color color2)

Parameters

color1

Color

The first Color structure to compare.

color2

Color

The second Color structure to compare.

Returns

bool

true if color1 and color2 are exactly identical; otherwise, false.

Equals(object)

Tests whether the specified object is a Color structure and is equivalent to the current color.

Declaration

cs-api-definition
public override bool Equals(object o)

Parameters

o

object

The object to compare to the current Color structure.

Returns

bool

true if the specified object is a Color structure and is identical to the current Color structure; otherwise, false.

Overrides ValueType.Equals(object)

FromAValues(float, float[], Uri)

Creates a new Color structure by using the specified alpha channel, color channel values, and color profile.

Declaration

cs-api-definition
public static Color FromAValues(float a, float[] values, Uri profileUri)

Parameters

a

float

The alpha channel for the new color.

values

float[]

A collection of values that specify the color channels for the new color. These values map to the profileUri.

profileUri

Uri

The International Color Consortium (ICC) or Image Color Management (ICM) color profile for the new color.

Returns

Color

A Color structure with the specified values.

FromArgb(byte, byte, byte, byte)

Creates a new Color structure by using the specified sRGB alpha channel and color channel values.

Declaration

cs-api-definition
public static Color FromArgb(byte a, byte r, byte g, byte b)

Parameters

a

byte

The alpha channel, A, of the new color.

r

byte

The red channel, R, of the new color.

g

byte

The green channel, G, of the new color.

b

byte

The blue channel, B, of the new color.

Returns

Color

A Color structure with the specified values.

FromRgb(byte, byte, byte)

Creates a new Color structure by using the specified sRGB color channel values.

Declaration

cs-api-definition
public static Color FromRgb(byte r, byte g, byte b)

Parameters

r

byte

The sRGB red channel, R, of the new color.

g

byte

The sRGB green channel, G, of the new color.

b

byte

The sRGB blue channel, B, of the new color.

Returns

Color

A Color structure with the specified values and an alpha channel value of 1.

FromScRgb(float, float, float, float)

Creates a new Color structure by using the specified ScRGB alpha channel and color channel values.

Declaration

cs-api-definition
public static Color FromScRgb(float a, float r, float g, float b)

Parameters

a

float

The ScRGB alpha channel, ScA, of the new color.

r

float

The ScRGB red channel, ScR, of the new color.

g

float

The ScRGB green channel, ScG, of the new color.

b

float

The ScRGB blue channel, ScB, of the new color.

Returns

Color

A Color structure with the specified values.

FromValues(float[], Uri)

Creates a new Color structure by using the specified color channel values and color profile.

Declaration

cs-api-definition
public static Color FromValues(float[] values, Uri profileUri)

Parameters

values

float[]

A collection of values that specify the color channels for the new color. These values map to the profileUri.

profileUri

Uri

The International Color Consortium (ICC) or Image Color Management (ICM) color profile for the new color.

Returns

Color

A Color structure with the specified values and an alpha channel value of 1.

GetComponentsFromPixel(int, out byte, out byte, out byte, out byte)

Declaration

cs-api-definition
public static void GetComponentsFromPixel(int pixel, out byte a, out byte r, out byte g, out byte b)

Parameters

pixel

int

a

byte

r

byte

g

byte

b

byte

GetHashCode()

Gets a hash code for the current Color structure.

Declaration

cs-api-definition
public override int GetHashCode()

Returns

int

A hash code for the current Color structure.

Overrides ValueType.GetHashCode()

GetNativeColorValues()

Gets the color channel values of the color.

Declaration

cs-api-definition
public float[] GetNativeColorValues()

Returns

float[]

An array of color channel values.

Multiply(Color, float)

Multiplies the alpha, red, blue, and green channels of the specified Color structure by the specified value.

Declaration

cs-api-definition
public static Color Multiply(Color color, float coefficient)

Parameters

color

Color

The Color to be multiplied.

coefficient

float

The value to multiply by.

Returns

Color

A new Color structure whose color values are the results of the multiplication operation.

ToString()

Creates a string representation of the color using the ScRGB channels.

Declaration

cs-api-definition
public override string ToString()

Returns

string

The string representation of the color.

Overrides ValueType.ToString()

ToString(IFormatProvider)

Creates a string representation of the color by using the ScRGB channels and the specified format provider.

Declaration

cs-api-definition
public string ToString(IFormatProvider provider)

Parameters

provider

IFormatProvider

Culture-specific formatting information.

Returns

string

The string representation of the color.

Operators

implicit operator Color(Color)

Declaration

cs-api-definition
public static implicit operator Color(Color color)

Parameters

color

Color

Returns

Color

implicit operator Color(Color)

Declaration

cs-api-definition
public static implicit operator Color(Color color)

Parameters

color

Color

Returns

Color

operator !=(Color, Color)

Declaration

cs-api-definition
public static bool operator !=(Color dColor, Color color)

Parameters

dColor

Color

color

Color

Returns

bool

operator !=(Color, Color)

Declaration

cs-api-definition
public static bool operator !=(Color color1, Color color2)

Parameters

color1

Color

color2

Color

Returns

bool

operator *(Color, float)

Multiplies the alpha, red, blue, and green channels of the specified Color structure by the specified value.

Declaration

cs-api-definition
public static Color operator *(Color color, float coefficient)

Parameters

color

Color

The Color to be multiplied.

coefficient

float

The value to multiply by.

Returns

Color

A new Color structure whose color values are the results of the multiplication operation.

operator ==(Color, Color)

Declaration

cs-api-definition
public static bool operator ==(Color dColor, Color color)

Parameters

dColor

Color

color

Color

Returns

bool

operator ==(Color, Color)

Declaration

cs-api-definition
public static bool operator ==(Color color1, Color color2)

Parameters

color1

Color

color2

Color

Returns

bool

Extension Methods