diff options
author | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2020-11-03 00:21:06 +0100 |
---|---|---|
committer | Aaron Franke <arnfranke@yahoo.com> | 2020-11-03 04:46:08 -0500 |
commit | 7adb6b91b33e297b4833ef5f82adcf64a15777f4 (patch) | |
tree | 8a47d75e5a7ea66f1b5deec162408887090cdd11 /core | |
parent | 873d4617852cddfd368e3046f718f410eade6a3e (diff) |
Remove `Color.contrasted()` as its behavior is barely useful
Returning the most contrasting color isn't a trivial task, as there
are often many possible choices. It's usually best left for the user
to implement using a script.
Diffstat (limited to 'core')
-rw-r--r-- | core/color.cpp | 12 | ||||
-rw-r--r-- | core/color.h | 2 | ||||
-rw-r--r-- | core/variant_call.cpp | 1 |
3 files changed, 0 insertions, 15 deletions
diff --git a/core/color.cpp b/core/color.cpp index c61ee0e64a..4047ca5037 100644 --- a/core/color.cpp +++ b/core/color.cpp @@ -217,12 +217,6 @@ void Color::invert() { b = 1.0 - b; } -void Color::contrast() { - r = Math::fmod(r + 0.5, 1.0); - g = Math::fmod(g + 0.5, 1.0); - b = Math::fmod(b + 0.5, 1.0); -} - Color Color::hex(uint32_t p_hex) { float a = (p_hex & 0xFF) / 255.0; p_hex >>= 8; @@ -284,12 +278,6 @@ Color Color::inverted() const { return c; } -Color Color::contrasted() const { - Color c = *this; - c.contrast(); - return c; -} - Color Color::html(const String &p_rgba) { String color = p_rgba; if (color.length() == 0) { diff --git a/core/color.h b/core/color.h index 2dbbc52905..8980efe74a 100644 --- a/core/color.h +++ b/core/color.h @@ -91,9 +91,7 @@ struct Color { bool is_equal_approx(const Color &p_color) const; void invert(); - void contrast(); Color inverted() const; - Color contrasted() const; _FORCE_INLINE_ Color lerp(const Color &p_b, float p_t) const { Color res = *this; diff --git a/core/variant_call.cpp b/core/variant_call.cpp index 6ffefccb67..182c475800 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -1614,7 +1614,6 @@ void register_variant_methods() { bind_method(Color, to_rgba64, sarray(), varray()); bind_method(Color, inverted, sarray(), varray()); - bind_method(Color, contrasted, sarray(), varray()); bind_method(Color, lerp, sarray("b", "t"), varray()); bind_method(Color, lightened, sarray("amount"), varray()); bind_method(Color, darkened, sarray("amount"), varray()); |