Merge pull request #11208 from kitsune/hex-color-shortcuts

Adds 3 and 4 digit html shortcuts to Color
This commit is contained in:
Rémi Verschelde 2017-09-19 23:33:25 +02:00 committed by GitHub
commit 27fb329c82

View file

@ -250,6 +250,14 @@ Color Color::html(const String &p_color) {
return Color();
if (color[0] == '#')
color = color.substr(1, color.length() - 1);
if (color.length() == 3 || color.length() == 4) {
String exp_color;
for (int i = 0; i < color.length(); i++) {
exp_color += color[i];
exp_color += color[i];
}
color = exp_color;
}
bool alpha = false;