skip navigation
  • Product Bundles

    DevCraft

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

    • AI Coding Assistants
    • Embedded Reporting
    • Document Processing Libraries
    • SSO Account Sign-in

    Web

    Kendo UI UI for Angular UI for Vue UI for jQuery KendoReact 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 Telerik JustMock

    CMS

    Sitefinity

    AI Productivity Tools

    AI Coding Assistants

    UI/UX Tools

    ThemeBuilder Design System Kit Templates and Building Blocks

    Debugging

    Fiddler Fiddler Everywhere Fiddler Classic Fiddler Everywhere Reporter FiddlerCore

    Free Tools

    KendoReact Free 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

Class ColorUtilities

Static helper class related to color.

Inheritance
System.Object
ColorUtilities
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Telerik.Windows.Diagrams.Core
Assembly: Telerik.WinControls.RadDiagram.dll

Syntax

public static class ColorUtilities

Fields

NamedColors

Know color names taken over from .Net.

Declaration
public static readonly IList<string> NamedColors
Field Value
System.Collections.Generic.IList<System.String>

NamedColorsRgb

The ARGB values corresponding to the NamedColors.

Declaration
public static readonly IList<string> NamedColorsRgb
Field Value
System.Collections.Generic.IList<System.String>

Properties

RandomBlues

Gets a random shade of blue.

Declaration
public static Color RandomBlues { get; }
Property Value
Color

The random blue color.

RandomBrush

Gets the random brush where the color is picked from the known Color.

Declaration
public static Brush RandomBrush { get; }
Property Value
System.Drawing.Brush

The random brush.

Methods

ByteArrayToHexString(Byte[])

Converts the given byte array to a color in the format #AARRGGBB.

Declaration
public static string ByteArrayToHexString(byte[] value)
Parameters
System.Byte[] value

The bytes.

Returns
System.String

ColorFromString(String)

Colors from string.

Declaration
public static Color ColorFromString(string hexValue)
Parameters
System.String hexValue

The hex string.

Returns
Color

ColorToString(Color)

Converts the specified color to a format #AARRGGBB. Use the ColorToString(Color) to convert a string back to a color.

Declaration
public static string ColorToString(Color color)
Parameters
Color color

The value to convert.

Returns
System.String

A string representing the specified value.

FromAngle(Double)

Creates a color from an angle.

Declaration
public static Color FromAngle(double value)
Parameters
System.Double value

The angle in degrees.

Returns
Color

FromArgb(Byte, Byte, Byte, Byte)

Returns brush from ARGB values.

Declaration
public static Brush FromArgb(byte alfa, byte red, byte green, byte blue)
Parameters
System.Byte alfa

The alfa.

System.Byte red

The red.

System.Byte green

The green.

System.Byte blue

The blue.

Returns
System.Drawing.Brush

FromHsl(Double, Double, Double)

Returns a color based on its HSL value.

Declaration
public static Color FromHsl(double hue, double saturation, double luminance)
Parameters
System.Double hue

The hue.

System.Double saturation

The saturation.

System.Double luminance

The luminance.

Returns
Color

The corresponding color.

HexStringFromSolidColor(Color)

Declaration
public static string HexStringFromSolidColor(Color color)
Parameters
Color color

The color.

Returns
System.String

HexStringToByteArray(String)

Converts the #AARRGGBB string color to a byte array.

Declaration
public static byte[] HexStringToByteArray(string color)
Parameters
System.String color

The hex string value of the color.

Returns
System.Byte[]

Multiply(Color, Double)

Multiplies/scales the specified color.

Declaration
public static Color Multiply(this Color color, double factor)
Parameters
Color color

The color.

System.Double factor

The factor.

Returns
Color

Parse(Int32)

Parses the specified value and converts it to a color.

Declaration
public static Color Parse(int value)
Parameters
System.Int32 value

The value.

Returns
Color

Parse(String)

Parses the specified color string (e.g. '#FF4B4578').

Declaration
public static Color Parse(string value)
Parameters
System.String value

The string representation of the color.

Returns
Color

ParseToBrush(String)

Parses to brush.

Declaration
public static SolidBrush ParseToBrush(string hexValue)
Parameters
System.String hexValue

The hex string.

Returns
System.Drawing.SolidBrush

RgbToHsl(Color)

Given a Color (RGB Struct) in range of 0-255 Return H,S,L in the range [0,1].

Declaration
public static HslColor RgbToHsl(Color colorRgb)
Parameters
Color colorRgb

The RGB.

Returns
HslColor

StringToColor(String)

Converts the specified string value to Color.

Declaration
public static Color StringToColor(string value)
Parameters
System.String value

The string value to convert from.

Returns
Color

A Color value that is deserialized from the specified string.

Sum(Color, Color)

Adds the two given Color.

Declaration
public static Color Sum(Color color1, Color color2)
Parameters
Color color1

The first color.

Color color2

The second color.

Returns
Color

ToValue(Color)

Returns the unsigned integer value of the color.

Declaration
public static int ToValue(Color color)
Parameters
Color color

The color.

Returns
System.Int32

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.