Add == support on Color (#1126)

This commit is contained in:
Joe4evr
2018-08-30 23:29:05 +02:00
committed by Christopher F
parent 2de6cef18c
commit a2d8800115

View File

@@ -100,6 +100,17 @@ namespace Discord
(uint)(b * 255.0f); (uint)(b * 255.0f);
} }
public static bool operator ==(Color lhs, Color rhs)
=> lhs.RawValue == rhs.RawValue;
public static bool operator !=(Color lhs, Color rhs)
=> lhs.RawValue != rhs.RawValue;
public override bool Equals(object obj)
=> (obj is Color c && RawValue == c.RawValue);
public override int GetHashCode() => RawValue.GetHashCode();
#if NETSTANDARD2_0 || NET45 #if NETSTANDARD2_0 || NET45
public static implicit operator StandardColor(Color color) => public static implicit operator StandardColor(Color color) =>
StandardColor.FromArgb((int)color.RawValue); StandardColor.FromArgb((int)color.RawValue);