Sprite color feature request

Hi, I’ve been using TMPro a while and I’ve found it somewhat frustrating to constantly have to set icon colours in my text strings using and then matching up the color to the text color.

It would be great is there was something like this:

and then have the sprite use whatever color the text object is using.

Have you tried using the “tint=1” attribute? This will tint the sprite based on the vertex color.

1 Like

omg. ok that’ll do it.

Thanks. Just tried it and it does the trick.

1 Like

As long as your sprites are grey scale, that should do the trick indeed :slight_smile:

Slightly related:

Is it possible to get sprites to use the font material’s outline and shadow properties somehow? Or perhaps specify which material to render the sprite with?

I have different fonts, some with outlines, some with shadows, some with thicker outlines and shadows etc… if the Icon doesn’t match it doesn’t quite look right. I understand that those font effects are achieved with the distance field rendering thingy… but what if we hooked it up so unity could use ‘shadow’ and ‘outline’ UIEffects components on icons for TMPro

Can you post an image of those icons? Are these 1 bit mono or 8 bit ?

If they are 1 bit mono, it would then be possible to create a custom font so that you could create an SDF Font Asset for those where you would then be able to use the same shaders and visual FX like Outline, underlay, etc.

1 Like

No, they aren’t 1 bit mono. But knowing that is useful.

It is pretty easy to create a custom font and to add various shapes to it. Here is one of the web sites / web app that I have used in the past.

There should also be a few posts on the forum about this process.

Side note: When using multiple font assets and fallbacks, it is recommended to use the same ratio of Sampling Point Size to Padding as this ratio determines the effective range of material properties such as Dilation, Outline Width, Underlay offset, etc.

This will ensure visual consistency between these font assets when using the same outline width values for example.

1 Like