Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VisImageButton getImage().setColor(color) does not work. #355

Closed
unenergizer opened this issue Mar 2, 2021 · 4 comments
Closed

VisImageButton getImage().setColor(color) does not work. #355

unenergizer opened this issue Mar 2, 2021 · 4 comments
Labels

Comments

@unenergizer
Copy link

unenergizer commented Mar 2, 2021

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.

@czyzby
Copy link
Collaborator

czyzby commented Mar 2, 2021

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?

@unenergizer
Copy link
Author

unenergizer commented Mar 2, 2021

@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!

java_eeU8YP6h23
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!

@czyzby
Copy link
Collaborator

czyzby commented Mar 3, 2021

@unenergizer

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.

@kotcrab
Copy link
Owner

kotcrab commented Mar 14, 2021

Thank you both, I've fixed it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants