summaryrefslogtreecommitdiff
path: root/core/variant
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-02-02 09:49:35 +0100
committerGitHub <noreply@github.com>2021-02-02 09:49:35 +0100
commit122a27523da45d68b98e53dc5d6ca2b95f908ad1 (patch)
tree861d42cbe83625eb3771c6d43c73599b2c3a0a71 /core/variant
parentb24c24f64b4ac9c30dc5a9e097163cbc64939645 (diff)
parentf55445079ad8e84cd337063b8cbac6eaf06d5592 (diff)
Merge pull request #45030 from aaronfranke/color-str-construct
Replace ColorN and from HTML with a string constructor
Diffstat (limited to 'core/variant')
-rw-r--r--core/variant/variant.cpp2
-rw-r--r--core/variant/variant_construct.cpp2
2 files changed, 3 insertions, 1 deletions
diff --git a/core/variant/variant.cpp b/core/variant/variant.cpp
index 7824776fdb..015cee09a7 100644
--- a/core/variant/variant.cpp
+++ b/core/variant/variant.cpp
@@ -2023,7 +2023,7 @@ Variant::operator Color() const {
if (type == COLOR) {
return *reinterpret_cast<const Color *>(_data._mem);
} else if (type == STRING) {
- return Color::html(operator String());
+ return Color(operator String());
} else if (type == INT) {
return Color::hex(operator int());
} else {
diff --git a/core/variant/variant_construct.cpp b/core/variant/variant_construct.cpp
index 9835734583..52f9f6060e 100644
--- a/core/variant/variant_construct.cpp
+++ b/core/variant/variant_construct.cpp
@@ -688,6 +688,8 @@ void Variant::_register_variant_constructors() {
add_constructor<VariantConstructor<Color, Color, double>>(sarray("from", "alpha"));
add_constructor<VariantConstructor<Color, double, double, double>>(sarray("r", "g", "b"));
add_constructor<VariantConstructor<Color, double, double, double, double>>(sarray("r", "g", "b", "a"));
+ add_constructor<VariantConstructor<Color, String>>(sarray("code"));
+ add_constructor<VariantConstructor<Color, String, double>>(sarray("code", "alpha"));
add_constructor<VariantConstructNoArgs<StringName>>(sarray());
add_constructor<VariantConstructor<StringName, StringName>>(sarray("from"));