summaryrefslogtreecommitdiff
path: root/core/variant
diff options
context:
space:
mode:
authorAaron Franke <arnfranke@yahoo.com>2020-12-06 17:37:34 -0500
committerAaron Franke <arnfranke@yahoo.com>2021-02-01 17:27:19 -0500
commitf55445079ad8e84cd337063b8cbac6eaf06d5592 (patch)
tree861d42cbe83625eb3771c6d43c73599b2c3a0a71 /core/variant
parentb24c24f64b4ac9c30dc5a9e097163cbc64939645 (diff)
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"));