diff --git a/Sources/Model/ColorDieFace.cs b/Sources/Model/ColorDieFace.cs
index 76c455e..ace2392 100644
--- a/Sources/Model/ColorDieFace.cs
+++ b/Sources/Model/ColorDieFace.cs
@@ -8,14 +8,37 @@ namespace Model
{
public class ColorDieFace : AbstractDieFace
{
- private string ColorHex;
+ ///
+ /// a decimal representation of the hex (...representation of the color)
+ ///
+ protected override int Value { get; }
- public ColorDieFace(string v)
+ ///
+ /// accepts hex strings like "ffbb84" ([RRGGBB])
+ ///
+ /// hex string
+ public ColorDieFace(string hexValueString)
{
- this.ColorHex = v;
+ // https://stackoverflow.com/questions/1139957/convert-integer-to-hexadecimal-and-back-again
+
+ // if style is ("f0b"), this constructor can develop it to "ff00bb" before doing the job
+
+ Value = int.Parse(hexValueString, System.Globalization.NumberStyles.HexNumber);
}
- public string getColorHex() { return ColorHex; }
- public void setColorHex(string ColorHex) { this.ColorHex = ColorHex; }
+ ///
+ /// accepts a decimal value that represents a color hex (0 is black, 65280 is green...)
+ ///
+ ///
+ public ColorDieFace(int decimalValue)
+ {
+ Value = decimalValue;
+ }
+ public override object GetPracticalValue()
+ {
+ // https://stackoverflow.com/questions/1139957/convert-integer-to-hexadecimal-and-back-again
+ // maybe prepend it with a "#"...
+ return Value.ToString("X");
+ }
}
}