Browse Source

Add == support on Color (#1126)

tags/2.0
Joe4evr Christopher F 6 years ago
parent
commit
a2d8800115
1 changed files with 11 additions and 0 deletions
  1. +11
    -0
      src/Discord.Net.Core/Entities/Roles/Color.cs

+ 11
- 0
src/Discord.Net.Core/Entities/Roles/Color.cs View File

@@ -100,6 +100,17 @@ namespace Discord
(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);


Loading…
Cancel
Save