Receives the _color expressed by the string.
true if a _color was successfully parsed from the string, false otherwise.
// common hex formats supported: // 3 digits assert(colorFromString("F80") == RGB8(0xFF, 0x88, 0x00)); assert(colorFromString("#F80") == RGB8(0xFF, 0x88, 0x00)); assert(colorFromString("$F80") == RGB8(0xFF, 0x88, 0x00)); // 6 digits assert(colorFromString("FF8000") == RGB8(0xFF, 0x80, 0x00)); assert(colorFromString("#FF8000") == RGB8(0xFF, 0x80, 0x00)); assert(colorFromString("$FF8000") == RGB8(0xFF, 0x80, 0x00)); // 4/8 digita (/w alpha) assert(colorFromString!RGBA8("#8C41") == RGBA8(0xCC, 0x44, 0x11, 0x88)); assert(colorFromString!RGBA8("#80CC4401") == RGBA8(0xCC, 0x44, 0x01, 0x80)); // named colors (case-insensitive) assert(colorFromString("red") == RGB8(0xFF, 0x0, 0x0)); assert(colorFromString("WHITE") == RGB8(0xFF, 0xFF, 0xFF)); assert(colorFromString("LightGoldenrodYellow") == RGB8(250,250,210)); // parse failure RGB8 c; assert(colorFromString("Ultraviolet", c) == false);
Create a color from a string.
This version of the function is nothrow, @nogc.