Skip to content
CShift0.32

Color

Struct · namespace System.Image · Since 0.28

struct Color : IEquatable<Color>, IHashable

A color: alpha, red, green and blue, from 0 to 255 each (an alpha of 0 is transparent, 255 opaque).

var red = Color.FromRgb(255, 0, 0);
uint32 argb = red.ToArgb(); // 0xFFFF0000
var same = Color.FromArgb(argb);
Name Description
A Alpha: 0 is transparent, 255 opaque.
R Red.
G Green.
B Blue.
uint8 A

Alpha: 0 is transparent, 255 opaque.

uint8 R

Red.

uint8 G

Green.

uint8 B

Blue.

Name Description
FromArgb A color from its four components (0 to 255 each).
FromRgb An opaque color from red, green and blue (0 to 255 each).
Transparent Transparent white, 0x00FFFFFF (like Color.Transparent of .NET; Image.Create fills with transparent black, 0).
Black Opaque black.
White Opaque white.
static Color FromArgb(int alpha, int red, int green, int blue)

A color from its four components (0 to 255 each).

Panics when a component is not 0 to 255.

static Color FromArgb(uint32 argb)

A color from a 32-bit value 0xAARRGGBB (the value of Color.ToArgb and of Image.Pixels).

static Color FromRgb(int red, int green, int blue)

An opaque color from red, green and blue (0 to 255 each).

Panics when a component is not 0 to 255.

static Color Transparent()

Transparent white, 0x00FFFFFF (like Color.Transparent of .NET; Image.Create fills with transparent black, 0).

static Color Black()

Opaque black.

static Color White()

Opaque white.

Name Description
ToArgb The color as a 32-bit value 0xAARRGGBB.
Equals Whether all four components are the same.
GetHashCode A hash code (the ARGB value).
ToString The color as text: #AARRGGBB.
uint32 ToArgb()

The color as a 32-bit value 0xAARRGGBB.

bool Equals(Color other)

Whether all four components are the same.

int GetHashCode()

A hash code (the ARGB value).

string ToString()

The color as text: #AARRGGBB.