Luski.Net/Luski.net/Structures/Public/Color.cs

60 lines
1.0 KiB
C#

using System;
namespace Luski.net.Structures.Public;
public struct Color
{
public Color(string servercol)
{
byte[] t = Convert.FromHexString(servercol);
r = t[0];
g = t[1];
b = t[2];
a = t[3];
}
public static bool operator ==(Color a, Color b)
{
return a.r == b.r && a.g == b.g && a.b == b.b && a.a == b.a;
}
public static bool operator !=(Color a, Color b)
{
return a.r != b.r || a.g != b.g || a.b != b.b || a.a != b.a;
}
public Color(byte R, byte G, byte B, byte A)
{
r = R;
g = G;
b = B;
a = A;
}
public string ToDatabaseStr()
{
return Convert.ToHexString(new []{r,g,b,a});
}
private byte r;
private byte g;
private byte b;
private byte a;
public byte A
{
get => a;
}
public byte R
{
get => r;
}
public byte G
{
get => g;
}
public byte B
{
get => b;
}
}