Convert Color
detect background color and convert to select color
Shader code
shader_type canvas_item;
uniform sampler2D screen_texture : hint_screen_texture, filter_nearest;
uniform vec4 black : source_color = vec4(0.067, 0.012, 0.067, 1.0);
uniform vec4 blue : source_color = vec4(0.365, 0.373, 0.776, 1.0);
uniform vec4 green : source_color = vec4(0.431, 0.82, 0.541, 1.0);
uniform vec4 white : source_color = vec4(0.898, 0.914, 0.91, 1.0);
void fragment() {
vec4 new_color = texture(screen_texture, SCREEN_UV, 0.0);
if (new_color.a > 0.0)
{
if(distance(new_color, black) < 0.1)
{
COLOR = blue;
}
if(distance(new_color, blue) < 0.1)
{
COLOR = green;
}
if(distance(new_color, green) < 0.1)
{
COLOR = white;
}
}
}