Add == support on Color (#1126)
This commit is contained in:
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user