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

Component.isBackgroundSet() and similar not respected #32

Closed
Chrriis opened this issue Jan 7, 2020 · 3 comments
Closed

Component.isBackgroundSet() and similar not respected #32

Chrriis opened this issue Jan 7, 2020 · 3 comments
Milestone

Comments

@Chrriis
Copy link
Contributor

Chrriis commented Jan 7, 2020

Hi,

I have a toggle button on which the background and foreground colors are forced, but it paints as if these were not set. It seems the code in Flat*ButtonUI does not get the background from the component even though they were explicitly set.

Am I missing something?

PS: very good work, I am impressed by the quality of FlatLaf!

@DevCharly
Copy link
Collaborator

Hi Chrriis,

thanks for the complements 😃

Yes, if the toggle button is selected (or disabled) then the component background and foreground colors are not used. In other states (unselected, hover and pressed) those colors are used.

If you've build FlatLaf locally, you can run FlatComponentsTest and check the "explicit colors" checkbox try it out:

image

So the toggle button should compute reasonable background and foreground colors for the selected state, based on the component colors, right?

Sounds like a good idea 👍

@Chrriis
Copy link
Contributor Author

Chrriis commented Jan 8, 2020

I wonder what the expected behavior is. I checked with a different look and feel, and unless I am missing something it was ignored there too.

Maybe deriving a reasonable background is not a bad idea. Now, the problem is to define "reasonable" 🙂

My original problem is that we use toggle buttons in a panel to act as task bar buttons and the difference between selected and not selected was not obvious with FlatLaf, so I tried to force colors. In the original look and feel there is a better contrast by default. While I could change the colors for all buttons of FlatLaf, I only wanted to alter these task bar buttons.

DevCharly added a commit that referenced this issue Apr 22, 2020
@DevCharly DevCharly added this to the 0.32 milestone Apr 22, 2020
@DevCharly
Copy link
Collaborator

Implemented in master branch. The selected toggle button background color is now computed at runtime based on the unselected background color.

image

Fixed in FlatLaf 0.32

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

No branches or pull requests

2 participants