mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:37:46 +00:00
LibGfx+LibWeb: Move "transparent" keyword into Color::from_string()
It seemed odd to have this one color handled separately, when `Color::from_string()` implements all other CSS colors.
This commit is contained in:
parent
2ab089fa21
commit
21b65de1ec
2 changed files with 3 additions and 2 deletions
|
@ -245,6 +245,9 @@ Optional<Color> Color::from_string(const StringView& string)
|
|||
{ 0x000000, nullptr }
|
||||
};
|
||||
|
||||
if (string == "transparent")
|
||||
return Color::from_rgba(0x00000000);
|
||||
|
||||
for (size_t i = 0; !web_colors[i].name.is_null(); ++i) {
|
||||
if (string == web_colors[i].name)
|
||||
return Color::from_rgb(web_colors[i].color);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue