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 (116 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.

1 Answer

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 (7,190 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

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 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 webmaster@godotengine.org with your username.