Shader that changes colors doesnt affect tilemaps but it does affect everything else.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Nonken

So i got this shader from a youtube video and it worked perfectly with colorrects but not so much with tilemaps.

Heres the shader:

shader_type canvas_item;

uniform vec4 old_color:hint_color;
uniform vec4 new_color:hint_color;

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

    if (current_pixel == old_color)
        COLOR = new_color;
    else
        COLOR = current_pixel;
}

You input the original color of the texture in the old_color vec4 and input the modified color in the new_color vec4.

Im completely new to shaders and dont understand anything of whats going on in this code so please excuse me if its something obvious.