diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2024-04-23 11:49:25 +1000 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2024-04-23 11:49:25 +1000 |
commit | c24fc5aeaf0e94bc6148c6d1bfd7a5643affc808 (patch) | |
tree | 59b6fead6a39b957a559358816e81bf90213a140 | |
parent | 7136c929cea0ddf955ab69a8ff5a4394bedacea8 (diff) |
micro-opt Color construction
toLower call not necessary, NamedColors is case-insensitive
-rw-r--r-- | source/core/StarColor.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/source/core/StarColor.cpp b/source/core/StarColor.cpp index 2137a36..7da8dd4 100644 --- a/source/core/StarColor.cpp +++ b/source/core/StarColor.cpp @@ -214,10 +214,10 @@ Color Color::gray(uint8_t g) { Color::Color() {} Color::Color(StringView name) { - if (name.beginsWith('#')) - *this = fromHex(name.substr(1)); + if (name.utf8().rfind('#', 0) == 0) + *this = fromHex(name.utf8().substr(1)); else { - auto i = NamedColors.find(String(name).toLower()); + auto i = NamedColors.find(String(name)); if (i != NamedColors.end()) *this = i->second; else |