mirror of https://github.com/adamdruppe/arsd.git
convenience ctor
This commit is contained in:
parent
6343bf04ca
commit
ea853b4bb7
11
color.d
11
color.d
|
@ -211,6 +211,17 @@ struct Color {
|
||||||
this.a = cast(ubyte) alpha;
|
this.a = cast(ubyte) alpha;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/++
|
||||||
|
Construct a color from components[0 .. 4]. It must have length of at least 4 and be in r, g, b, a order.
|
||||||
|
|
||||||
|
History:
|
||||||
|
Added July 18, 2022 (dub v10.9)
|
||||||
|
+/
|
||||||
|
nothrow pure @nogc
|
||||||
|
this(ubyte[] components) {
|
||||||
|
this.components[] = components[0 .. 4];
|
||||||
|
}
|
||||||
|
|
||||||
/// Static convenience functions for common color names
|
/// Static convenience functions for common color names
|
||||||
nothrow pure @nogc
|
nothrow pure @nogc
|
||||||
static Color transparent() { return Color(0, 0, 0, 0); }
|
static Color transparent() { return Color(0, 0, 0, 0); }
|
||||||
|
|
Loading…
Reference in New Issue