How to change a sprite's color before the shader takes effect?

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

Working in 2D here, I have a shader that converts a sprite into grayscale, but I was wondering if there was a way to change the sprite’s color before converting to grayscale via shader (so that way the color is reflected in the grayscale).

Using modulate changes the color no matter the material/shader, so is there another way to do this? Thank you in advance!

EDIT:
Figured it out on my own! For reference, if anyone else wants to do this as well, here is what I ended up doing:

shader_type canvas_item;
uniform vec4 tint_color : hint_color;

void fragment() {
	COLOR = tint_color * texture(TEXTURE, UV);
    float avg = (COLOR.r + COLOR.g + COLOR.b) / 3.0;
    COLOR.rgb = vec3(avg);
}