This commit is contained in:
Noah Pilarski 2022-08-15 06:25:56 -04:00
parent fb5b7b87c8
commit dc14871cb4
2 changed files with 26 additions and 4 deletions

View File

@ -62,7 +62,7 @@ namespace NewHorizons.Builder.Body
config.ProcGen = new ProcGenModule()
{
scale = size,
color = new MColor(126, 94, 73, 255)
color = new MColor(126, 94, 73)
};
}
else

View File

@ -1,4 +1,4 @@
using System.ComponentModel;
using System.ComponentModel;
using Newtonsoft.Json;
using UnityEngine;
namespace NewHorizons.Utility
@ -6,7 +6,7 @@ namespace NewHorizons.Utility
[JsonObject]
public class MColor
{
public MColor(int r, int g, int b, int a)
public MColor(int r, int g, int b, int a = 255)
{
this.r = r;
this.g = g;
@ -37,8 +37,30 @@ namespace NewHorizons.Utility
/// </summary>
[System.ComponentModel.DataAnnotations.Range(0, 255)]
[DefaultValue(255)]
public int a;
public int a = 255;
public Color ToColor() => new Color(r / 255f, g / 255f, b / 255f, a / 255f);
public static MColor red => new MColor(255, 0, 0);
public static MColor green => new MColor(0, 255, 0);
public static MColor blue => new MColor(0, 0, 255);
public static MColor white => new MColor(255, 255, 255);
public static MColor black => new MColor(0, 0, 0);
public static MColor yellow => new MColor(255, 235, 4);
public static MColor cyan => new MColor(0, 255, 255);
public static MColor magenta => new MColor(255, 0, 255);
public static MColor gray => new MColor(127, 127, 127);
public static MColor grey => new MColor(127, 127, 127);
public static MColor clear => new MColor(0, 0, 0, 0);
}
}