diff --git a/core/color.cpp b/core/color.cpp
index c61ee0e64a3..4047ca50377 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 2dbbc529059..8980efe74a1 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 6ffefccb679..182c475800f 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());
diff --git a/doc/classes/Color.xml b/doc/classes/Color.xml
index ef438e422a3..70529e0ee66 100644
--- a/doc/classes/Color.xml
+++ b/doc/classes/Color.xml
@@ -159,23 +159,6 @@
[/codeblocks]
-
-
-
-
- Returns the most contrasting color.
- [codeblocks]
- [gdscript]
- var color = Color(0.3, 0.4, 0.9)
- var contrasted_color = color.contrasted() # Equivalent to RGBA(204, 229, 102, 255)
- [/gdscript]
- [csharp]
- var color = new Color(0.3f, 0.4f, 0.9f);
- Color contrastedColor = color.Contrasted(); // Equivalent to RGBA(204, 229, 102, 255)
- [/csharp]
- [/codeblocks]
-
-
diff --git a/modules/gdnative/gdnative/color.cpp b/modules/gdnative/gdnative/color.cpp
index c75e74daba6..e08183ab635 100644
--- a/modules/gdnative/gdnative/color.cpp
+++ b/modules/gdnative/gdnative/color.cpp
@@ -148,13 +148,6 @@ godot_color GDAPI godot_color_inverted(const godot_color *p_self) {
return dest;
}
-godot_color GDAPI godot_color_contrasted(const godot_color *p_self) {
- godot_color dest;
- const Color *self = (const Color *)p_self;
- *((Color *)&dest) = self->contrasted();
- return dest;
-}
-
godot_color GDAPI godot_color_lerp(const godot_color *p_self, const godot_color *p_b, const godot_real p_t) {
godot_color dest;
const Color *self = (const Color *)p_self;
diff --git a/modules/gdnative/gdnative_api.json b/modules/gdnative/gdnative_api.json
index 82bfbd23de2..40d0f758717 100644
--- a/modules/gdnative/gdnative_api.json
+++ b/modules/gdnative/gdnative_api.json
@@ -1254,13 +1254,6 @@
["const godot_color *", "p_self"]
]
},
- {
- "name": "godot_color_contrasted",
- "return_type": "godot_color",
- "arguments": [
- ["const godot_color *", "p_self"]
- ]
- },
{
"name": "godot_color_lerp",
"return_type": "godot_color",
diff --git a/modules/gdnative/include/gdnative/color.h b/modules/gdnative/include/gdnative/color.h
index e7737bf8e17..e64097ef57d 100644
--- a/modules/gdnative/include/gdnative/color.h
+++ b/modules/gdnative/include/gdnative/color.h
@@ -93,8 +93,6 @@ godot_int GDAPI godot_color_to_argb32(const godot_color *p_self);
godot_color GDAPI godot_color_inverted(const godot_color *p_self);
-godot_color GDAPI godot_color_contrasted(const godot_color *p_self);
-
godot_color GDAPI godot_color_lerp(const godot_color *p_self, const godot_color *p_b, const godot_real p_t);
godot_color GDAPI godot_color_blend(const godot_color *p_self, const godot_color *p_over);
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Color.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Color.cs
index 3700a6194f2..d0add835c01 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Color.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Color.cs
@@ -256,20 +256,6 @@ namespace Godot
return res;
}
- ///
- /// Returns the most contrasting color.
- ///
- /// The most contrasting color
- public Color Contrasted()
- {
- return new Color(
- (r + 0.5f) % 1.0f,
- (g + 0.5f) % 1.0f,
- (b + 0.5f) % 1.0f,
- a
- );
- }
-
///
/// Returns a new color resulting from making this color darker
/// by the specified ratio (on the range of 0 to 1).
diff --git a/scene/gui/gradient_edit.cpp b/scene/gui/gradient_edit.cpp
index ecd4ad17ead..53d7ead5485 100644
--- a/scene/gui/gradient_edit.cpp
+++ b/scene/gui/gradient_edit.cpp
@@ -357,7 +357,7 @@ void GradientEdit::_notification(int p_what) {
//Draw point markers
for (int i = 0; i < points.size(); i++) {
- Color col = points[i].color.contrasted();
+ Color col = points[i].color.inverted();
col.a = 0.9;
draw_line(Vector2(points[i].offset * total_w, 0), Vector2(points[i].offset * total_w, h / 2), col);
diff --git a/tests/test_color.h b/tests/test_color.h
index dfdc29ec7de..e5b6899908a 100644
--- a/tests/test_color.h
+++ b/tests/test_color.h
@@ -185,9 +185,6 @@ TEST_CASE("[Color] Manipulation methods") {
CHECK_MESSAGE(
blue.inverted().is_equal_approx(Color(1, 1, 0, 0.4)),
"Inverted color should have its red, green and blue components inverted.");
- CHECK_MESSAGE(
- blue.contrasted().is_equal_approx(Color(0.5, 0.5, 0.5, 0.4)),
- "Contrasted pure blue should be fully gray.");
const Color purple = Color(0.5, 0.2, 0.5, 0.25);