shader_type canvas_item;

uniform vec4 replace : source_color  = vec4(0.0);
uniform float intensity : hint_range(0.0, 5.0, 0.1);

void vertex() {
	// Called for every vertex the material is visible on.
}

void fragment() {
    vec4 tex_color = texture(TEXTURE, UV);

    float color_diff = distance(tex_color.rgb, replace.rgb);

    if (color_diff < 0.03) {
		COLOR = tex_color * intensity;
	} else
	{
		COLOR = tex_color;
	}
}