Color

Container for an rgba colour.

Constructors

this
this(ubyte r, ubyte g, ubyte b, ubyte a)

Constructs a colour using rgb(a) values (in range 0..255). By default alpha is 0% transparent (255).

this
this(Color[] colors)

Creates the average colour of the given one.

Members

Functions

opEquals
bool opEquals(Object o)

Compares two colours.

Properties

argb
uint argb [@property getter]

Encodes the colour as an unsigned integer to be used in the network operations or to be saved.

rgb
uint rgb [@property getter]
rgba
uint rgba [@property getter]

Encodes the colour as an unsigned integer to be used in the network operations or to be saved.

transparent
bool transparent [@property getter]

Checks if the colour is completely transparent (with the alpha channel equals to 0).

transparent
bool transparent [@property setter]

Sets the colour as transparent (with alpha = 0) or opaque (with alpha = 255).

Static functions

fromRGB
Color fromRGB(uint c)

Converts an rgb-encoded integer to a Color.

fromString
Color fromString(string c)

Converts and hexadecimal representation of a colour into a Color object.

Variables

a
ubyte a;
b
ubyte b;
g
ubyte g;
Undocumented in source.
r
ubyte r;
Undocumented in source.

Examples

Color c = new Color(255, 0, 0);
c.blue = 255;
assert(c == new Color(255, 0, 255));

Meta