skip navigation
  • Product Bundles

    DevCraft

    All Telerik .NET tools and Kendo UI JavaScript components in one package. Now enhanced with:

    • NEW: Design Kits for Figma
    • Online Training
    • Document Processing Library
    • Embedded Reporting for web and desktop

    Web

    Kendo UI UI for jQuery UI for Angular UI for React UI for Vue UI for Blazor UI for ASP.NET Core UI for ASP.NET MVC UI for ASP.NET AJAX

    Mobile

    UI for .NET MAUI

    Document Management

    Telerik Document Processing

    Desktop

    UI for .NET MAUI UI for WinUI UI for WinForms UI for WPF

    Reporting

    Telerik Reporting Telerik Report Server

    Testing & Mocking

    Test Studio Test Studio Dev Edition Telerik JustMock

    CMS

    Sitefinity

    UI/UX Tools

    ThemeBuilder Design System Kit Templates and Building Blocks

    Debugging

    Fiddler Fiddler Everywhere Fiddler Classic Fiddler Everywhere Reporter FiddlerCore

    Free Tools

    VB.NET to C# Converter Testing Framework
    View all products
  • Overview
  • Demos
    • What's New
    • Roadmap
    • Release History
  • Support and Learning

    • Support and Learning Hub
    • First Steps
    • Docs
    • Demos
    • Virtual Classroom
    • Forums
    • Videos
    • Blogs
    • Accessibility
    • Submit a Ticket

    Productivity and Design Tools

    • Visual Studio Extensions
    • Visual Studio Templates
    • Embedded Reporting
  • Pricing
  • Shopping cart
    • Account Overview
    • Your Licenses
    • Downloads
    • Support Center
    • Forum Profile
    • Payment Methods
    • Edit Profile
    • Log out
  • Login
  • Contact Us
  • Try now

Struct Color

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

Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetType()
Namespace: Telerik.WinControls.RichTextEditor.UI
Assembly: Telerik.WinControls.RichTextEditor.dll

Syntax

public struct Color : IFormattable

Properties

A

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

Declaration
public byte A { get; set; }
Property Value
System.Byte

The sRGB alpha channel value of the color.

B

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

Declaration
public byte B { get; set; }
Property Value
System.Byte

The sRGB blue channel value of the current System.Windows.Media.Color structure.

G

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

Declaration
public byte G { get; set; }
Property Value
System.Byte

The sRGB green channel value of the current System.Windows.Media.Color structure.

R

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

Declaration
public byte R { get; set; }
Property Value
System.Byte

The sRGB red channel value of the current System.Windows.Media.Color structure.

ScA

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

Declaration
public float ScA { get; set; }
Property Value
System.Single

The ScRGB alpha channel value of the current System.Windows.Media.Color structure.

ScB

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

Declaration
public float ScB { get; set; }
Property Value
System.Single

The ScRGB red channel value of the current System.Windows.Media.Color structure.

ScG

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

Declaration
public float ScG { get; set; }
Property Value
System.Single

The ScRGB green channel value of the current System.Windows.Media.Color structure.

ScR

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

Declaration
public float ScR { get; set; }
Property Value
System.Single

The ScRGB red channel value of the current System.Windows.Media.Color structure.

Methods

AreClose(Color, Color)

Compares two System.Windows.Media.Color structures for fuzzy equality.

Declaration
public static bool AreClose(Color color1, Color color2)
Parameters
Color color1

The first color to compare.

Color color2

The second color to compare.

Returns
System.Boolean

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
public void Clamp()

Equals(Object)

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

Declaration
public override bool Equals(object o)
Parameters
System.Object o

The object to compare to the current System.Windows.Media.Color structure.

Returns
System.Boolean

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

Overrides
System.ValueType.Equals(System.Object)

Equals(Color)

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

Declaration
public bool Equals(Color color)
Parameters
Color color

The System.Windows.Media.Color structure to compare to the current System.Windows.Media.Color structure.

Returns
System.Boolean

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

Equals(Color, Color)

Tests whether two System.Windows.Media.Color structures are identical.

Declaration
public static bool Equals(Color color1, Color color2)
Parameters
Color color1

The first System.Windows.Media.Color structure to compare.

Color color2

The second System.Windows.Media.Color structure to compare.

Returns
System.Boolean

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

FromArgb(Byte, Byte, Byte, Byte)

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

Declaration
public static Color FromArgb(byte a, byte r, byte g, byte b)
Parameters
System.Byte a

The alpha channel, System.Windows.Media.Color.A, of the new color.

System.Byte r

The red channel, System.Windows.Media.Color.R, of the new color.

System.Byte g

The green channel, System.Windows.Media.Color.G, of the new color.

System.Byte b

The blue channel, System.Windows.Media.Color.B, of the new color.

Returns
Color

A System.Windows.Media.Color structure with the specified values.

FromAValues(Single, Single[], Uri)

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

Declaration
public static Color FromAValues(float a, float[] values, Uri profileUri)
Parameters
System.Single a

The alpha channel for the new color.

System.Single[] values

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

System.Uri profileUri

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

Returns
Color

A System.Windows.Media.Color structure with the specified values.

FromRgb(Byte, Byte, Byte)

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

Declaration
public static Color FromRgb(byte r, byte g, byte b)
Parameters
System.Byte r

The sRGB red channel, System.Windows.Media.Color.R, of the new color.

System.Byte g

The sRGB green channel, System.Windows.Media.Color.G, of the new color.

System.Byte b

The sRGB blue channel, System.Windows.Media.Color.B, of the new color.

Returns
Color

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

FromScRgb(Single, Single, Single, Single)

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

Declaration
public static Color FromScRgb(float a, float r, float g, float b)
Parameters
System.Single a

The ScRGB alpha channel, System.Windows.Media.Color.ScA, of the new color.

System.Single r

The ScRGB red channel, System.Windows.Media.Color.ScR, of the new color.

System.Single g

The ScRGB green channel, System.Windows.Media.Color.ScG, of the new color.

System.Single b

The ScRGB blue channel, System.Windows.Media.Color.ScB, of the new color.

Returns
Color

A System.Windows.Media.Color structure with the specified values.

FromValues(Single[], Uri)

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

Declaration
public static Color FromValues(float[] values, Uri profileUri)
Parameters
System.Single[] values

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

System.Uri profileUri

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

Returns
Color

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

GetComponentsFromPixel(Int32, out Byte, out Byte, out Byte, out Byte)

Declaration
public static void GetComponentsFromPixel(int pixel, out byte a, out byte r, out byte g, out byte b)
Parameters
System.Int32 pixel

System.Byte a

System.Byte r

System.Byte g

System.Byte b

GetHashCode()

Gets a hash code for the current System.Windows.Media.Color structure.

Declaration
public override int GetHashCode()
Returns
System.Int32

A hash code for the current System.Windows.Media.Color structure.

Overrides
System.ValueType.GetHashCode()

GetNativeColorValues()

Gets the color channel values of the color.

Declaration
public float[] GetNativeColorValues()
Returns
System.Single[]

An array of color channel values.

Multiply(Color, Single)

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

Declaration
public static Color Multiply(Color color, float coefficient)
Parameters
Color color

The System.Windows.Media.Color to be multiplied.

System.Single coefficient

The value to multiply by.

Returns
Color

A new System.Windows.Media.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
public override string ToString()
Returns
System.String

The string representation of the color.

Overrides
System.ValueType.ToString()

ToString(IFormatProvider)

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

Declaration
public string ToString(IFormatProvider provider)
Parameters
System.IFormatProvider provider

Culture-specific formatting information.

Returns
System.String

The string representation of the color.

Operators

Equality(Color, Color)

Declaration
public static bool operator ==(Color dColor, Color color)
Parameters
System.Drawing.Color dColor

Color color

Returns
System.Boolean

Equality(Color, Color)

Declaration
public static bool operator ==(Color color1, Color color2)
Parameters
Color color1

Color color2

Returns
System.Boolean

Implicit(Color to Color)

Declaration
public static implicit operator Color(Color color)
Parameters
System.Drawing.Color color

Returns
Color

Implicit(Color to Color)

Declaration
public static implicit operator Color(Color color)
Parameters
Color color

Returns
System.Drawing.Color

Inequality(Color, Color)

Declaration
public static bool operator !=(Color dColor, Color color)
Parameters
System.Drawing.Color dColor

Color color

Returns
System.Boolean

Inequality(Color, Color)

Declaration
public static bool operator !=(Color color1, Color color2)
Parameters
Color color1

Color color2

Returns
System.Boolean

Multiply(Color, Single)

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

Declaration
public static Color operator *(Color color, float coefficient)
Parameters
Color color

The System.Windows.Media.Color to be multiplied.

System.Single coefficient

The value to multiply by.

Returns
Color

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

Explicit Interface Implementations

IFormattable.ToString(String, IFormatProvider)

Declaration
string IFormattable.ToString(string format, IFormatProvider provider)
Parameters
System.String format

System.IFormatProvider provider

Returns
System.String

Implements
System.IFormattable.ToString(System.String, System.IFormatProvider)

Extension Methods

ExtensionMethods.BlendWith(Color, Color)
ExtensionMethods.Darker(Color)
ExtensionMethods.Darker(Color, Byte)
ExtensionMethods.Lighter(Color)
ExtensionMethods.Lighter(Color, Byte)
ExtensionMethods.LighterUsingHsl(Color)
SvgExtentions.Traverse<T>(T, Func<T, IEnumerable<T>>)
SvgExtentions.TraverseDepthFirst<T>(T, Func<T, IEnumerable<T>>)
Getting Started
  • Install Now
  • Demos
  • Step-by-Step Tutorial
  • Sample Applications
  • SDK Samples
  • Visual Studio Extensions
Support Resources
  • Code Library
  • Knowledge Base
  • Videos
Community
  • Forums
  • Blogs
  • Feedback Portal
  • Document Processing Feedback Portal

Copyright © 2018 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.

Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.