Browse Source

fix: add .NET Standard 2.1 support for Color (#1405)

* Add NETSTANDARD2_1 support for Color

* Remove all conditionals following PR
tags/2.2.0
Patrick Klaeren Monica S 5 years ago
parent
commit
7f0c0c9155
1 changed files with 0 additions and 4 deletions
  1. +0
    -4
      src/Discord.Net.Core/Entities/Roles/Color.cs

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

@@ -1,8 +1,6 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
#if NETSTANDARD2_0 || NET45
using StandardColor = System.Drawing.Color; using StandardColor = System.Drawing.Color;
#endif


namespace Discord namespace Discord
{ {
@@ -190,12 +188,10 @@ namespace Discord


public override int GetHashCode() => RawValue.GetHashCode(); public override int GetHashCode() => RawValue.GetHashCode();


#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);
public static explicit operator Color(StandardColor color) => public static explicit operator Color(StandardColor color) =>
new Color((uint)color.ToArgb() << 8 >> 8); new Color((uint)color.ToArgb() << 8 >> 8);
#endif


/// <summary> /// <summary>
/// Gets the hexadecimal representation of the color (e.g. <c>#000ccc</c>). /// Gets the hexadecimal representation of the color (e.g. <c>#000ccc</c>).


Loading…
Cancel
Save