Hey guys,
I’m extremely extremely new to shaders, having had nothing to do with them before now so I dont understand a lot of stuff to do with them, so I apologize in advance if I say something extremely stupid.
First of all we’re working only with 2D sprites and no lighting.
What I need to do is to convert white on the texture to a different colour while keeping greys and any non-white colour. I have scrapped together the code below from a few different places however it only partly works - it converts greys and other light colours not just white.
Heres an example of what happens, the one on the left is the original and the right is the one with the shader applied.

Is there anyone who can help me make it so all the colours other than white remain the same? (Assuming that’s possible).
Here’s the code I have now;
Shader "colour_swap" {
Properties {
_MainTex ("Base (RGB), Alpha (A)", 2D) = "white" {}
}
SubShader {
Tags {
"Queue" = "Transparent"
"IgnoreProjector" = "True"
"RenderType" = "Transparent"
}
Pass {
Cull Off
Lighting Off
ZWrite Off
Fog { Mode Off }
Offset -1, -1
Blend SrcAlpha OneMinusSrcAlpha
ColorMaterial AmbientAndDiffuse
SetTexture [_MainTex] {
Combine Texture * Primary, Texture * Primary
}
SetTexture [_MainTex] {
Combine Texture +- previous, Texture * Primary
}
}
}
}