New to Telerik UI for WinFormsStart a free 30-day trial

Color

Struct

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

Definition

Namespace:Telerik.WinControls.SyntaxEditor.UI

Assembly:Telerik.WinControls.SyntaxEditor.dll

Syntax:

C#
[TypeConverter(typeof(WpfColorConverter))]
public struct Color : IFormattable

Implements: IFormattable

Properties

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

C#
public byte A { get; set; }
Property Value:

The sRGB alpha channel value of the color.

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

C#
public byte B { get; set; }
Property Value:

The sRGB blue channel value of the current Color structure.

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

C#
public byte G { get; set; }
Property Value:

The sRGB green channel value of the current Color structure.

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

C#
public byte R { get; set; }
Property Value:

The sRGB red channel value of the current Color structure.

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

C#
public float ScA { get; set; }
Property Value:

The ScRGB alpha channel value of the current Color structure.

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

C#
public float ScB { get; set; }
Property Value:

The ScRGB red channel value of the current Color structure.

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

C#
public float ScG { get; set; }
Property Value:

The ScRGB green channel value of the current Color structure.

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

C#
public float ScR { get; set; }
Property Value:

The ScRGB red channel value of the current Color structure.

Methods

Compares two Color structures for fuzzy equality.

C#
public static bool AreClose(Color color1, Color color2)
Parameters:color1Color

The first color to compare.

color2Color

The second color to compare.

Returns:

bool

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

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

C#
public void Clamp()

Tests whether two Color structures are identical.

C#
public static bool Equals(Color color1, Color color2)
Parameters:color1Color

The first Color structure to compare.

color2Color

The second Color structure to compare.

Returns:

bool

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

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

C#
public bool Equals(Color color)
Parameters:colorColor

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.

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

C#
public override bool Equals(object o)
Parameters:oobject

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)

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

C#
public static Color FromArgb(byte a, byte r, byte g, byte b)
Parameters:abyte

The alpha channel, A, of the new color.

rbyte

The red channel, R, of the new color.

gbyte

The green channel, G, of the new color.

bbyte

The blue channel, B, of the new color.

Returns:

Color

A Color structure with the specified values.

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

C#
public static Color FromAValues(float a, float[] values, Uri profileUri)
Parameters:afloat

The alpha channel for the new color.

valuesfloat[]

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

profileUriUri

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.

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

C#
public static Color FromRgb(byte r, byte g, byte b)
Parameters:rbyte

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

gbyte

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

bbyte

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.

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

C#
public static Color FromScRgb(float a, float r, float g, float b)
Parameters:afloat

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

rfloat

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

gfloat

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

bfloat

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

Returns:

Color

A Color structure with the specified values.

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

C#
public static Color FromValues(float[] values, Uri profileUri)
Parameters:valuesfloat[]

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

profileUriUri

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.

C#
public static void GetComponentsFromPixel(int pixel, out byte a, out byte r, out byte g, out byte b)
Parameters:pixelintabyterbytegbytebbyte

Gets a hash code for the current Color structure.

C#
public override int GetHashCode()
Returns:

int

A hash code for the current Color structure.

Overrides: ValueType.GetHashCode()

Gets the color channel values of the color.

C#
public float[] GetNativeColorValues()
Returns:

float[]

An array of color channel values.

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

C#
public static Color Multiply(Color color, float coefficient)
Parameters:colorColor

The Color to be multiplied.

coefficientfloat

The value to multiply by.

Returns:

Color

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

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

C#
public override string ToString()
Returns:

string

The string representation of the color.

Overrides: ValueType.ToString()

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

C#
public string ToString(IFormatProvider provider)
Parameters:providerIFormatProvider

Culture-specific formatting information.

Returns:

string

The string representation of the color.

Operators

C#
public static implicit operator Color(Color color)
Parameters:colorColorReturns:

Color

C#
public static implicit operator Color(Color color)
Parameters:colorColorReturns:

Color

C#
public static bool operator !=(Color dColor, Color color)
Parameters:dColorColorcolorColorReturns:

bool

C#
public static bool operator !=(Color color1, Color color2)
Parameters:color1Colorcolor2ColorReturns:

bool

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

C#
public static Color operator *(Color color, float coefficient)
Parameters:colorColor

The Color to be multiplied.

coefficientfloat

The value to multiply by.

Returns:

Color

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

C#
public static bool operator ==(Color dColor, Color color)
Parameters:dColorColorcolorColorReturns:

bool

C#
public static bool operator ==(Color color1, Color color2)
Parameters:color1Colorcolor2ColorReturns:

bool