9 lines
427 B
C#
9 lines
427 B
C#
namespace SharpChat;
|
|
|
|
public readonly record struct ColourRgb(int Raw) {
|
|
public byte Red => (byte)((Raw >> 16) & 0xFF);
|
|
public byte Green => (byte)((Raw >> 8) & 0xFF);
|
|
public byte Blue => (byte)(Raw & 0xFF);
|
|
public override string ToString() => string.Format("#{0:x2}{1:x2}{2:x2}", Red, Green, Blue);
|
|
public static ColourRgb FromRgb(byte red, byte green, byte blue) => new(red << 16 | green << 8 | blue);
|
|
}
|