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

Fix POM Graph colors for dark themes #5391

Merged
merged 1 commit into from
Feb 1, 2023

Conversation

johntor
Copy link
Contributor

@johntor johntor commented Jan 30, 2023

I noticed a problem using the Graph of a POM when a dark theme is selected.

The foreground color was requested from the Theme while backgrounds are hardcoded into the Class causing printing WHITE on Bright Colors.

With this fix I added transparency to these hardcoded colors so the become darker on darker backgrounds.

I also removed gradients that looked a bit outdated to my eyes.

215498346-c8cecdd1-e0a5-4354-9998-9b0bc4ad6ab9

@mbien mbien added UI User Interface Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) Maven [ci] enable "build tools" tests labels Jan 30, 2023
@neilcsmith-net neilcsmith-net added this to the NB17 milestone Jan 30, 2023
@mbien
Copy link
Member

mbien commented Jan 30, 2023

hi @johntor, thanks for working on this.

it certainly does look much better and I agree the gradients have to go given that NetBeans is using a theme called Flat LAF by default :)

However, I still see problems with FlatLAF dark, what theme are you using since your screenshorts show white font on dark background.

(FlatLaf dark, items in graph don't have focus)
before PR:
before-unfocussed

after PR:
after-unfocussed

@mbien
Copy link
Member

mbien commented Jan 30, 2023

the scope markers are now also painted as solid blocks which is going to need some tweaks too:
scope-after
(Cupertino Dark, scopes set to Test)

@johntor
Copy link
Contributor Author

johntor commented Jan 30, 2023

I did not notice all these! If you like the idea of the removed gradients we can optimize the code more.

@mbien
Copy link
Member

mbien commented Jan 30, 2023

@johntor would be great. Simply force push into this PR if you want to make changes.

I believe the font color might need to be hard coded if the custom (non-standard) background fill of the text element is active - otherwise there gonna be always some theme which will clash.

@johntor
Copy link
Contributor Author

johntor commented Jan 30, 2023

Yes I was thinking determining if the theme is light/dark then apply fixed black/white colors for fonts

@mbien
Copy link
Member

mbien commented Jan 30, 2023

Yes I was thinking determining if the theme is light/dark then apply fixed black/white colors for fonts

if the background is taken from the theme, its ok to take the font color from the theme too. But as soon the background is changed, for example when set to orange, the color can't be taken from the theme anymore - it has to fit to the orange background.

I wouldn't hardcode all font colors, only conditional when the background actually changes.

@neilcsmith-net
Copy link
Member

Yes, two hard coded colours for each pallette option based on value of nb.dark.theme boolean from UIManager might be way to go, at least for a quick fix.

@mbien
Copy link
Member

mbien commented Jan 30, 2023

Yes, two hard coded colours for each pallette option based on value of nb.dark.theme boolean from UIManager might be way to go, at least for a quick fix.

i don't think any of this needs to know if the dark theme is active or not if it follows the simple rule of changing both, foreground and background at the same time but never only one of them while leaving the other to the theme.

@johntor
Copy link
Contributor Author

johntor commented Jan 30, 2023

Yes, two hard coded colours for each pallette option based on value of nb.dark.theme boolean from UIManager might be way to go, at least for a quick fix.

i don't think any of this needs to know if the dark theme is active or not if it follows the simple rule of changing both, foreground and background at the same time but never only one of them while leaving the other to the theme.

Then we have problems to apply your light-grey text over orange or yellow. I will go with the hardcoded solution and we see how it goes...

@mbien
Copy link
Member

mbien commented Jan 30, 2023

Then we have problems to apply your light-grey text over orange or yellow.

why would you do that? I am trying to say that if you change the background to orange, you have to change the text to a fitting color too, so that it is readable on orange. You can't leave the text color up to the theme and hope it will still work.

@johntor
Copy link
Contributor Author

johntor commented Jan 31, 2023

Hello again I think is fine now but how am I supposed to update the file and how I force my pull request?

Image

Image (1)

Image (3)

@mbien
Copy link
Member

mbien commented Jan 31, 2023

Hello again I think is fine now but how am I supposed to update the file and how I force my pull request?

you have now two commits, I think the easiest option in this particular case is to remove the last commit again with:

git reset HEAD^

This will only remove the commit, the changes you made will remain in the source code.

Now you can simply commit with NetBeans again but check the Amend last Commit checkbox, this will add the changes to the first commit, instead of creating a second one again - basically updating the commit.

(the same command from the console would be git commit --amend --no-edit)

To replace the remote delivery branch with your local delivery branch you type in a console:

git push -f git@github.com:johntor/netbeans delivery:delivery

@neilcsmith-net
Copy link
Member

i don't think any of this needs to know if the dark theme is active or not if it follows the simple rule of changing both, foreground and background at the same time but never only one of them while leaving the other to the theme.

You create a palette of background colours that works with black-ish text, and one that works with white-ish text. Working on something similar with the visual library myself at the moment.

However, this fix looks good for now. If we can get it amended and force pushed as above, we can merge later today for 17-rc3.

@mbien
Copy link
Member

mbien commented Jan 31, 2023

You create a palette of background colours that works with black-ish text, and one that works with white-ish text. Working on something similar with the visual library myself at the moment.

If the background would be theme aware - the foreground must be theme aware too, I agree.

But in this particular case the background fill colors (red/orange) already work with dark/light themes, additionally to that the boxes have an outline which is controlled by the theme - which makes it extra resistant to clash with theme colors. So the main problem here was that some boxes set the background fill without setting the font color. That is the reason I said I do not think the logic has to be aware of the theme at all - it only has to follow the rule to not pick the foreground from a theme color while hard coding the background.

The visual for "Scopes" will need more work since it used to be a gradient but this is outside the scope of this PR :) (I don't think it will look good in any color the way it is currently rendered as simple box in a box)

@johntor
Copy link
Contributor Author

johntor commented Jan 31, 2023

I think current solution is simple and efficient for any color theme. Keep in mind the new feature of changing the colors of Flat Laf.

This solution is adaptioning theme colors while keeping original colors with BLACK foreground to boxes with background yellow orange and red.

Copy link
Member

@mbien mbien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you revert the formatting changes you did in the most recent commit We try to avoid unrelated changes in PRs which fix things.

Copy link
Contributor

@eirikbakke eirikbakke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this patch! I'm fine with this patch as long as it is tested well on both light and dark FlatLAF modes.

A general comment for future PRs is to try to keep the patches free of unnecessary formatting changes; this makes them easier to review. If you'd like to clean up formatting, it's good to do all the formatting changes in a single commit.

(A side note for @neilcsmith-net: aren't "release candidate" versions supposed to be very stable, with only critical bugfixes going into them? Patches like these benefit from being tested for a few weeks in dev environments before going into production.)

@mbien
Copy link
Member

mbien commented Jan 31, 2023

(A side note for @neilcsmith-net: aren't "release candidate" versions supposed to be very stable, with only critical bugfixes going into them? Patches like these benefit from being tested for a few weeks in dev environments before going into production.)

@eirikbakke well the colors and gradients were borderline unreadable before, so the bar is lower here for a hotfix. This is only a UI change which removes gradients and tweaks colors so it has low risk to cause trouble. I agree with the formatting changes which were added by the second commit - those should be reverted.

@eirikbakke
Copy link
Contributor

@mbien Yeah, I trust your judgment here.

(I just remember having made "cosmetic-only" patches like this myself only to find I introduced a NullPointerException somewhere a week later...)

@johntor
Copy link
Contributor Author

johntor commented Jan 31, 2023

I am sorry that I have no time to completed this Pull Request till the end right now... (busy at work)
Can anybody else take care of it?
I promise next time I will complete the work all the way...
Thank you all!
Keep on your great job!

@neilcsmith-net
Copy link
Member

A side note for @neilcsmith-net: aren't "release candidate" versions supposed to be very stable, with only critical bugfixes going into them?

Bug fixes until rc3, only critical fixes afterwards - https://lists.apache.org/thread/hyjbsz55zb9xfcnccghkrsvqsnt83nwf

Yes, there are risks to lower priority fixes, but it's worth it to improve the release experience IMO.

@mbien
Copy link
Member

mbien commented Jan 31, 2023

@johntor no worries. I can take over. Will remove the formatting changes and force push into this PR. Thanks for your work!

This might add me as co author to the commit. Lets see how this works.

Co-authored-by: Michael Bien <mbien42@gmail.com>
@mbien
Copy link
Member

mbien commented Jan 31, 2023

squashed, reverted formatting and force pushed

@mbien
Copy link
Member

mbien commented Jan 31, 2023

@eirikbakke @neilcsmith-net I am willing to accept this one as my side quest, if it causes followup problems assign issues to me.

@neilcsmith-net
Copy link
Member

Thanks @johntor and @mbien Will merge tomorrow.

@mbien given my comments on #5390 asking for it to be rebased, we can share any side quest 😆

@neilcsmith-net neilcsmith-net merged commit ba163d8 into apache:delivery Feb 1, 2023
@mbien
Copy link
Member

mbien commented Feb 1, 2023

@johntor congrats on your first contribution.

@johntor
Copy link
Contributor Author

johntor commented Feb 1, 2023

@johntor congrats on your first contribution.

Thank you very much! I thought contributing to a complicated project like Netbeans is too difficult... I realized that I was wrong!

I will be back!

Take care!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) Maven [ci] enable "build tools" tests UI User Interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants