Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/framework/util/color.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,17 @@ namespace {
{"yellow",rgb_to_abgr(0xFFFF00)}, {"yellowgreen",rgb_to_abgr(0x9ACD32)},
};

inline std::string to_lower(std::string_view s) {
std::string out; out.reserve(s.size());
for (unsigned char c : s) out.push_back(std::tolower(c));
inline std::string to_lower_ascii(std::string_view s) {
std::string out(s);
for (char &c : out)
if (c >= 'A' && c <= 'Z')
c |= 0x20;
return out;
}


inline bool css_lookup(std::string_view name, uint32_t& abgrOut) {
const auto key = to_lower(name);
const auto key = to_lower_ascii(name);

if (key == "transparent") { abgrOut = 0x00000000u; return true; }

Expand Down Expand Up @@ -405,4 +408,4 @@ std::istream& operator>>(std::istream& in, Color& color)
}

return in;
}
}
Loading