use ints on MColor

This commit is contained in:
JohnCorby 2022-07-13 20:51:07 -07:00
parent befb62366a
commit 93fc16aede

View File

@ -17,26 +17,26 @@ namespace NewHorizons.Utility
/// <summary> /// <summary>
/// The red component of this colour /// The red component of this colour
/// </summary> /// </summary>
[System.ComponentModel.DataAnnotations.Range(0f, int.MaxValue)] [System.ComponentModel.DataAnnotations.Range(0, int.MaxValue)]
public int r; public int r;
/// <summary> /// <summary>
/// The green component of this colour /// The green component of this colour
/// </summary> /// </summary>
[System.ComponentModel.DataAnnotations.Range(0f, int.MaxValue)] [System.ComponentModel.DataAnnotations.Range(0, int.MaxValue)]
public int g; public int g;
/// <summary> /// <summary>
/// The blue component of this colour /// The blue component of this colour
/// </summary> /// </summary>
[System.ComponentModel.DataAnnotations.Range(0f, int.MaxValue)] [System.ComponentModel.DataAnnotations.Range(0, int.MaxValue)]
public int b; public int b;
/// <summary> /// <summary>
/// The alpha (opacity) component of this colour /// The alpha (opacity) component of this colour
/// </summary> /// </summary>
[System.ComponentModel.DataAnnotations.Range(0f, 255f)] [System.ComponentModel.DataAnnotations.Range(0, 255)]
[DefaultValue(255f)] [DefaultValue(255)]
public int a; public int a;
public Color ToColor() => new Color(r / 255f, g / 255f, b / 255f, a / 255f); public Color ToColor() => new Color(r / 255f, g / 255f, b / 255f, a / 255f);