2 using System.Collections.Generic;
5 using System.Xml.Serialization;
21 private int _BrightnessRed;
30 get {
return _BrightnessRed; }
31 set { _BrightnessRed = value.Limit(0,255); }
34 private int _BrightnessGreen;
43 get {
return _BrightnessGreen; }
44 set { _BrightnessGreen = value.Limit(0, 255); }
47 private int _BrightnessBlue;
55 get {
return _BrightnessBlue; }
56 set { _BrightnessBlue = value.Limit(0, 255); }
64 public string HexColor
68 return "#{0:X2}{1:X2}{2:X2}".Build(Red, Green,Blue);
82 public bool SetColor(
int Red,
int Green,
int Blue)
98 if ((Color.Length == 6 && Color.IsHexString()) || (Color.Length == 7 && Color.StartsWith(
"#") && Color.IsHexString(1, 6)))
101 if (Color.StartsWith(
"#"))
109 SetColor(Color.Substring(0 + Offset, 2).HexToInt(), Color.Substring(2 + Offset, 2).HexToInt(), Color.Substring(4 + Offset, 2).HexToInt());
113 string[] SplitColors = Color.Split(
',');
114 if (SplitColors.Length == 3)
116 bool ColorsOK =
true;
117 foreach (
string C
in SplitColors)
126 SetColor(
int.Parse(SplitColors[0]),
int.Parse(SplitColors[1]),
int.Parse(SplitColors[2]));
145 public RGBColor(
int BrightnessRed,
int BrightnessGreen,
int BrightnessBlue){
146 SetColor(BrightnessRed, BrightnessGreen, BrightnessBlue);
RGBColor(string Color)
Initializes a new instance of the RGBColor class. The parameter string Color ist first parsed for he...
This class stores information on RGB colors used for toys and effects (e.g. RGBLed).
bool SetColor(string Color)
Sets the RGB components of the Color. The parameter string Color ist first parsed for hexadecimal c...
bool SetColor(int Red, int Green, int Blue)
Sets the RGB components of the Color.
The namespace DirectOutput.General contains classes for general use.
RGBColor(int BrightnessRed, int BrightnessGreen, int BrightnessBlue)
Initializes a new instance of the RGBColor class.