this can be approached in many different ways, however, a simple method is to create uniforms for both colors in your palette currently and replacement colors. For example;
uniform vec3 rep1;
uniform vec3 rep2;
uniform vec3 rep3;
uniform vec3 new1;
uniform vec3 new2;
uniform vec3 new3;
and then you can check if the sampled pixel is one of your colours to replace and pass the new colour instead if so;
//Sample the original pixel
gl_FragColor = v_vColour * texture2D( gm_BaseTexture, v_vTexcoord );
//Make it easier to compare (out of 255 instead of 1)
vec3 test = vec3(
gl_FragColor.r * 255.0,
gl_FragColor.g * 255.0,
gl_FragColor.b * 255.0
);
//Check if it needs to be replaced
if (test == rep1) {test = new1;}
if (test == rep2) {test = new2;}
if (test == rep3) {test = new3;}
//return the result in the original format
gl_FragColor = vec4(
test.r / 255.0,
test.g / 255.0,
test.b / 255.0,
gl_FragColor.a
);
Then in your room creation code (or other initialization code) you can set the shader and define the pallete to be replaced and what to replace with it, for example:
// -- Set Pallete --
shader_set(sPalleter)
//Red
shader_set_uniform_f(shader_get_uniform(sPalleter, "rep1"), 255, 0, 0)
shader_set_uniform_f(shader_get_uniform(sPalleter, "new1"), 155, 188, 15)
//White
shader_set_uniform_f(shader_get_uniform(sPalleter, "rep2"), 255, 255, 255)
shader_set_uniform_f(shader_get_uniform(sPalleter, "new2"), 48, 98, 48)
//Black
shader_set_uniform_f(shader_get_uniform(sPalleter, "rep3"), 0, 0, 0)
shader_set_uniform_f(shader_get_uniform(sPalleter, "new3"), 15, 56, 15)
Extending this you could create a sprite and potentially sample it for the uniforms, anyway hope this helped!