Browse Source

Merge pull request #114 from khionu/patch-1

Added ToString and DebuggerDisplay
tags/1.0-rc
RogueException GitHub 9 years ago
parent
commit
d111bf08ee
1 changed files with 10 additions and 1 deletions
  1. +10
    -1
      src/Discord.Net/Entities/Roles/Color.cs

+ 10
- 1
src/Discord.Net/Entities/Roles/Color.cs View File

@@ -1,5 +1,9 @@
using System;
using System.Diagnostics;

namespace Discord namespace Discord
{ {
[DebuggerDisplay(@"{DebuggerDisplay,nq}")]
public struct Color public struct Color
{ {
/// <summary> Gets the default user color value. </summary> /// <summary> Gets the default user color value. </summary>
@@ -32,6 +36,11 @@
((uint)(r * 255.0f) << 16) | ((uint)(r * 255.0f) << 16) |
((uint)(g * 255.0f) << 8) | ((uint)(g * 255.0f) << 8) |
(uint)(b * 255.0f); (uint)(b * 255.0f);
}
}
public override string ToString() =>
$"#{Convert.ToString(RawValue, 16)}";
private string DebuggerDisplay() =>
$"#{Convert.ToString(RawValue, 16)} ({RawValue})";
} }
} }

Loading…
Cancel
Save