Changing an image font's color

Godot Version

v4.6.1.stable.official [14d19694e]

Question

My game uses several fonts, all stored in the form of textures. Currently I use a palette shader to change the font color, however, it becomes a problem when I want to change the color of a single word, since the shader applies to the entire texture.

It might be even more of a problem because even the smallest font uses 2 colors, one for the outline and another for the inside, and the outline is supposed to always be dark gray, so I only want the inside to be changed. Any ideas what I can do?

The most basic solution I can think of is to use BBCode with a RichTextLabel. That way you can use the [color] tags and change any part of the text you want, even through code. This isn’t super flexible, but definitely simple to implement.

Huh, wow, it actually does work. I kinda expected it not to, because it’s an image rather than a set of vectors, so I expected it to work differently I guess? But uh, thanks. It’s not exactly the effect I want, but I guess coupled with the palette shader it will probably work out.

1 Like