Class ColorUtilities
Static helper class related to color.
Inheritance
Inherited Members
Namespace: Telerik.Windows.Diagrams.Core
Assembly: Telerik.Windows.Controls.Diagrams.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
System.Windows.Media.Color
The random blue color. |
RandomBrush
Gets the random brush where the color is picked from the known colors.
Declaration
public static Brush RandomBrush { get; }
Property Value
System.Windows.Media.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
System.Windows.Media.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
System.Windows.Media.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
System.Windows.Media.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.Windows.Media.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
System.Windows.Media.Color
The corresponding color. |
HexStringFromSolidColor(Color)
Declaration
public static string HexStringFromSolidColor(Color color)
Parameters
System.Windows.Media.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
System.Windows.Media.Color
color
The color. |
System.Double
factor
The factor. |
Returns
System.Windows.Media.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
System.Windows.Media.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
System.Windows.Media.Color
|
ParseToBrush(String)
Parses to brush.
Declaration
public static SolidColorBrush ParseToBrush(string hexValue)
Parameters
System.String
hexValue
The hex string. |
Returns
System.Windows.Media.SolidColorBrush
|
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
System.Windows.Media.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
System.Windows.Media.Color
A Color value that is deserialized from the specified string. |
Sum(Color, Color)
Adds the two given colors.
Declaration
public static Color Sum(Color color1, Color color2)
Parameters
System.Windows.Media.Color
color1
The first color. |
System.Windows.Media.Color
color2
The second color. |
Returns
System.Windows.Media.Color
|
ToValue(Color)
Returns the unsigned integer value of the color.
Declaration
public static int ToValue(Color color)
Parameters
System.Windows.Media.Color
color
The color. |
Returns
System.Int32
|