Browse Source

Added preset PackedColors (thanks izy!)

tags/docs-0.9
RogueException 9 years ago
parent
commit
5163d5482d
1 changed files with 34 additions and 3 deletions
  1. +34
    -3
      src/Discord.Net/Models/PackedColor.cs

+ 34
- 3
src/Discord.Net/Models/PackedColor.cs View File

@@ -4,6 +4,37 @@ namespace Discord
{
public class PackedColor
{
public static readonly PackedColor Default = PresetColor(0);

public static readonly PackedColor Aqua = PresetColor(1752220);
public static readonly PackedColor DarkAqua = PresetColor(1146986);
public static readonly PackedColor Green = PresetColor(3066993);
public static readonly PackedColor DarkGreen = PresetColor(2067276);
public static readonly PackedColor Blue = PresetColor(3447003);
public static readonly PackedColor DarkBlue = PresetColor(2123412);
public static readonly PackedColor Purple = PresetColor(10181046);
public static readonly PackedColor DarkPurple = PresetColor(7419530);
public static readonly PackedColor Gold = PresetColor(15844367);
public static readonly PackedColor DarkGold = PresetColor(12745742);
public static readonly PackedColor Orange = PresetColor(15105570);
public static readonly PackedColor DarkOrange = PresetColor(11027200);
public static readonly PackedColor Red = PresetColor(15158332);
public static readonly PackedColor DarkRed = PresetColor(10038562);
public static readonly PackedColor Navy = PresetColor(3426654);
public static readonly PackedColor DarkNavy = PresetColor(2899536);

public static readonly PackedColor LighterGrey = PresetColor(12370112);
public static readonly PackedColor LightGrey = PresetColor(9807270);
public static readonly PackedColor DarkGrey = PresetColor(9936031);
public static readonly PackedColor DarkerGrey = PresetColor(8359053);

private static PackedColor PresetColor(uint packedValue)
{
PackedColor color = new PackedColor(packedValue);
color.Lock();
return color;
}

private bool _isLocked;
private uint _rawValue;
public uint RawValue
@@ -20,11 +51,11 @@ namespace Discord
public PackedColor(uint rawValue) { _rawValue = rawValue; }

/// <summary> Gets or sets the red component for this color. </summary>
public byte Red { get { return GetByte(3); } set { SetByte(3, value); } }
public byte R { get { return GetByte(3); } set { SetByte(3, value); } }
/// <summary> Gets or sets the green component for this color. </summary>
public byte Green { get { return GetByte(2); } set { SetByte(2, value); } }
public byte G { get { return GetByte(2); } set { SetByte(2, value); } }
/// <summary> Gets or sets the blue component for this color. </summary>
public byte Blue { get { return GetByte(1); } set { SetByte(1, value); } }
public byte B { get { return GetByte(1); } set { SetByte(1, value); } }

internal void Lock() => _isLocked = true;
internal void SetRawValue(uint rawValue)


Loading…
Cancel
Save