Class WebColors
This class is a HashMap that contains the names of colors as a key and the corresponding RGB color as value.
public class WebColors : Dictionary<string, int[]>, IDictionary<string, int[]>, ICollection<KeyValuePair<string, int[]>>, IDictionary, ICollection, IReadOnlyDictionary<string, int[]>, IReadOnlyCollection<KeyValuePair<string, int[]>>, IEnumerable<KeyValuePair<string, int[]>>, IEnumerable, ISerializable, IDeserializationCallback
- Inheritance
-
WebColors
- Implements
- Inherited Members
Remarks
This class is a HashMap that contains the names of colors as a key and the corresponding RGB color as value. (Source: Wikipedia http://en.wikipedia.org/wiki/Web_colors )
Constructors
WebColors()
public WebColors()
Fields
NAMES
HashMap containing all the names and corresponding color values.
public static readonly WebColors NAMES
Field Value
Methods
GetCMYKArray(string)
Gives an array of five floats that contain CMYK values and opacity, each value is between 0 and 1.
public static float[] GetCMYKArray(string name)
Parameters
name
string'device-cmyk(c, m, y, k)' structure
Returns
- float[]
the corresponding array of five floats, or
null
if parsing failed.
GetCMYKColor(string)
Gives you a DeviceCmyk based on a name.
public static DeviceCmyk GetCMYKColor(string name)
Parameters
name
string'device-cmyk(c, m, y, k)' structure
Returns
- DeviceCmyk
the corresponding DeviceCmyk object. Never returns null.
GetRGBAColor(string)
Gives an array of four floats that contain RGBA values, each value is between 0 and 1.
public static float[] GetRGBAColor(string name)
Parameters
name
stringa name such as black, violet, cornflowerblue or #RGB or #RRGGBB or RGB or RRGGBB or rgb(R,G,B) or rgb(R,G,B,A)
Returns
- float[]
the corresponding array of four floats, or
null
if parsing failed.
GetRGBColor(string)
Gives you a DeviceRgb based on a name.
public static DeviceRgb GetRGBColor(string name)
Parameters
name
stringa name such as black, violet, cornflowerblue or #RGB or #RRGGBB or RGB or RRGGBB or rgb(R,G,B)
Returns
- DeviceRgb
the corresponding DeviceRgb object. Never returns null.