micro-opt Color construction
toLower call not necessary, NamedColors is case-insensitive
This commit is contained in:
parent
7136c929ce
commit
c24fc5aeaf
@ -214,10 +214,10 @@ Color Color::gray(uint8_t g) {
|
|||||||
Color::Color() {}
|
Color::Color() {}
|
||||||
|
|
||||||
Color::Color(StringView name) {
|
Color::Color(StringView name) {
|
||||||
if (name.beginsWith('#'))
|
if (name.utf8().rfind('#', 0) == 0)
|
||||||
*this = fromHex(name.substr(1));
|
*this = fromHex(name.utf8().substr(1));
|
||||||
else {
|
else {
|
||||||
auto i = NamedColors.find(String(name).toLower());
|
auto i = NamedColors.find(String(name));
|
||||||
if (i != NamedColors.end())
|
if (i != NamedColors.end())
|
||||||
*this = i->second;
|
*this = i->second;
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user