From c24fc5aeaf0e94bc6148c6d1bfd7a5643affc808 Mon Sep 17 00:00:00 2001 From: Kae <80987908+Novaenia@users.noreply.github.com> Date: Tue, 23 Apr 2024 11:49:25 +1000 Subject: [PATCH] micro-opt Color construction toLower call not necessary, NamedColors is case-insensitive --- source/core/StarColor.cpp | 6 +++--- 1 file 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