The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

0 votes

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.

Godot version 3.3
in Engine by (120 points)

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.

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.

2 Answers

0 votes
Best answer

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.

by (8,550 points)
selected by

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?).

Yeah you'd have to do that

0 votes

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.

by (40 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.