Skip to content

Commit

Permalink
Add == support on Color (#1126)
Browse files Browse the repository at this point in the history
  • Loading branch information
Joe4evr authored and foxbot committed Aug 30, 2018
1 parent 2de6cef commit a2d8800
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Discord.Net.Core/Entities/Roles/Color.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit a2d8800

Please sign in to comment.