VisImageButton getImage().setColor(color) does not work.
unenergizer opened this issue · 4 comments
As stated in the title, when I do visImageButton.getImage().setColor(Color.RED);
Nothing happens. I can set a color to the background but that is about it. However, if I do the same thing using a regular ImageButton, it works just fine.
It's likely due to these lines:
if (generateDisabledImage && style.imageDisabled == null && isDisabled())
image.setColor(Color.GRAY);
else
image.setColor(Color.WHITE);
The color is overridden to support the automatic disabled icon generation. I think the generateDisabledImage
check should be extracted before this whole code block to avoid changing the color if this feature is not enabled:
if (generateDisabledImage && style.imageDisabled == null) {
if (isDisabled())
image.setColor(Color.GRAY);
else
image.setColor(Color.WHITE);
}
@unenergizer Would you like to test this and submit a pull request?
@czyzby I can confirm that this does indeed work. I copied the entire VisImageButton
class into a new one, made some changes to the skin and wala it worked! However I would love to do a pull request, but I don't actually know how to do that. I only know how to submit code to my own projects default branch. Sorry!
As you can see in the image above. The right hand window has highlighted button background and a yellow color tint applied to the button image. Exactly what I was looking for!
However I would love to do a pull request, but I don't actually know how to do that.
You have to make a fork of the library (top right icon), make the required changes in code and click on the pull request button. See this article for more details.
Thank you both, I've fixed it.