summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2017-09-19 23:33:25 +0200
committerGitHub <noreply@github.com>2017-09-19 23:33:25 +0200
commit27fb329c8272e14e2addce928dd8ba8ff2011d0c (patch)
tree90bc47e9d5f6f1c3fb95ce0f4663d8b2db17a5e3
parent2785444f891c04ad6d778378bf367cf649b77e91 (diff)
parent8bff891f3c22551664e7f82702b5f778b780654b (diff)
Merge pull request #11208 from kitsune/hex-color-shortcuts
Adds 3 and 4 digit html shortcuts to Color
-rw-r--r--core/color.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/color.cpp b/core/color.cpp
index dd8b13c047..78b11a84df 100644
--- a/core/color.cpp
+++ b/core/color.cpp
@@ -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;