Color.fromString

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

class Color
static pure @safe
fromString
(
string c
)

Return Value

Type: Color

a Color object or null if the string's length is invalid

Throws

ConvException if one of the string is not an hexadecimal number

Examples

assert(Color.fromString("00CC00").green == 204);
assert(Color.fromString("123456").rgb == 0x123456);
assert(Color.fromString("01F") == Color.fromString("0011FF"));

Meta