Fixed color conversion

This commit is contained in:
Lukasz Baldyga committed 2020-11-30 09:28:43 +00:00
1 parent d5e52853c1
commit 3623ddcbfa
1 file changed
+2 -1
@@ -30,7 +30,8 @@ namespace Advanced_Software_Engineering.Verbs.Value.ValueTypes {
public Color ToColor() { public Color ToColor() {
if (!colorValueCacheAvailable) { if (!colorValueCacheAvailable) {
int i = (int)Math.Round(value * 255); int i = (int)Math.Round(value * 255);
i = Math.Max(255, i); i = Math.Min(255, i);
if (i < 0) i = 0;
colorValueCache = ValueHelper.IntsToColor(i, i, i); colorValueCache = ValueHelper.IntsToColor(i, i, i);
colorValueCacheAvailable = true; colorValueCacheAvailable = true;
} }