From a2d8800115c7cc41d82871a68cd08fcdecc747ab Mon Sep 17 00:00:00 2001 From: Joe4evr Date: Thu, 30 Aug 2018 23:29:05 +0200 Subject: [PATCH] Add == support on Color (#1126) --- src/Discord.Net.Core/Entities/Roles/Color.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Discord.Net.Core/Entities/Roles/Color.cs b/src/Discord.Net.Core/Entities/Roles/Color.cs index 0bb04d339e..727049dcc0 100644 --- a/src/Discord.Net.Core/Entities/Roles/Color.cs +++ b/src/Discord.Net.Core/Entities/Roles/Color.cs @@ -100,6 +100,17 @@ public Color(float r, float g, float b) (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 public static implicit operator StandardColor(Color color) => StandardColor.FromArgb((int)color.RawValue);