Is it possible to change the tint/shade colour of a disabled button's icon?

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

I have a button with an icon and a custom theme (StyleBoxTextures for the button’s different states). For when the button is disabled, I want to customize (or remove) the tint/shade colour of the button’s icon.

Is this possible to do? I can set the colour a disabled button’s text through its theme, but I haven’t seen a similar option for its icon.

Not the best option but you could try setting the modulate property the button when it’s disabled. Otherwise, I think you would need to either need to supply a different texture or edit the texture through code (which is a tad cumbersome) when you disable the button.

timothybrentwood | 2021-05-14 23:31

Changing the button’s modulate property or using a different texture wouldn’t get me the tint I’d want unless it’s to be as dark as or darker than the default tint, since the default tint is still affecting the icon. Especially since what I actually want to do is get rid of the tint.

AaronWizard | 2021-05-14 23:41

:bust_in_silhouette: Reply From: exuin

I don’t think this is possible, but you can open a proposal on GitHub. You can also try just putting a TextureRect on top of the button instead of using an icon. I think if you play around with raw values in modulate you can actually make it lighter, but it’s probably best to not use the Button’s icon if you don’t want the tint.

I found I can get the effect I want by adding a TextureRect as a child of my button instead of using the button’s icon.

Though it’s not convenient if I want to use an icon and text at the same time since I’d have to manage the placement of the button’s text (I guess I’d use a separate Label as another child of the button then?).

AaronWizard | 2021-05-15 20:51

Yeah you’d have to do that

exuin | 2021-05-15 21:09

:bust_in_silhouette: Reply From: LeMilonkh

It seems you can do this now (in Godot 3.5 at least).
You can add the icon_color_disabled theme property to the button’s theme (or global game theme), and set the color to your tint.
I used this to disable the button from graying out when disabled, for which you should set font_color_disabled and icon_color_disabled to full white.