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 icon color in dark mode #7917

Closed
wants to merge 2 commits into from
Closed

Fix icon color in dark mode #7917

wants to merge 2 commits into from

Conversation

JJJoex
Copy link

@JJJoex JJJoex commented Jul 18, 2021

Solution to, fixes #7853
After checking dark.css and base.css, and tempting change color of the icons, but find out the color of icons can not be changed, because the icon imported from Package org.kordamp.ikonli.mamaterialdesign is colored and can not be changed. So rather than import another set of icons, I prefer adjusting icon-background-color in dark mode. Then you can find the icon button easily. The effect is shown in the figure.

  • Change in CHANGELOG.md described in a way that is understandable for the average user (if applicable)
  • Tests created for changes (if applicable)
  • Manually tested changed features in running JabRef (always required)
  • Screenshots added in PR description (for UI changes)
  • Checked documentation: Is the information available and up to date? If not created an issue at https://github.com/JabRef/user-documentation/issues or, even better, submitted a pull request to the documentation repository.

@JJJoex JJJoex changed the title New Solution to issue#7853 Jul 18, 2021
@Siedlerchr Siedlerchr changed the title Solution to issue#7853 Fix icon color in dark mode Jul 18, 2021
@Siedlerchr
Copy link
Member

Thanks for your PR, can you please add some Screenshots so we can see your changes?

@JJJoex
Copy link
Author

JJJoex commented Jul 18, 2021

@Siedlerchr Images are listing below:
In light theme:figure1,figure2,figure3
In dark theme(original):figuer1 ,figure2,figure3
In dark theme(modified):figure1,figure2,figure3

@Siedlerchr Siedlerchr requested a review from calixtus July 18, 2021 12:22
@calixtus
Copy link
Member

calixtus commented Jul 18, 2021

This seems very odd, that the icon color could not be changed and would be a major bug in the ikonli package.
Did you try changing the ikonli-font-icon css class like described here? https://kordamp.org/ikonli/#_javafx

@calixtus
Copy link
Member

A great tool for debugging javafx guis is https://github.com/JonathanGiles/scenic-view . This should help here too.

@JJJoex
Copy link
Author

JJJoex commented Jul 18, 2021

@calixtus Thank you for providing informations, I will improve this a few days later.

@JJJoex
Copy link
Author

JJJoex commented Jul 19, 2021

@calixtus @Siedlerchr I modified the icon colors by changing color of each icon in fxml files, not in css file. Then there's a problem that no matter in light mode or in dark mode these icons' color will not changed. So I wonder how can i change these icons in css files. And there's some figures after change, do you have any suggestion?
In dark mode:figure1, figure2, figure3
In light mode:figure1, figure2, figure3

@JJJoex
Copy link
Author

JJJoex commented Jul 19, 2021

I change the color of icon by adding icon-color of the buttons in fxml files. Though it works partly, i think there may a better way to solve this problem.

@Siedlerchr
Copy link
Member

I think you can simply override the icon color in the dark.css
Have a look at the glyph-icon and also test with scenic view

@JJJoex
Copy link
Author

JJJoex commented Jul 19, 2021

@Siedlerchr I‘ve tested glyph-icon, but it didn't work. I think override the icon color in dark.css may work. But, how to reference these button-icon in css file is kinda hard for me? But i will try.

@calixtus
Copy link
Member

According to the documentation of ikonli https://kordamp.org/ikonli/#_javafx you need to change the -fx-icon-color in the css subclass ikonli-font-icon. Please use scenicview to determine the right hierarchy this subclass belongs to.

See here:
Screenshot_20210719-133741

There is also an exception for stacked panes.

@calixtus
Copy link
Member

Btw. according to our documentation the base color of icons should always be the same as the text.

@JJJoex
Copy link
Author

JJJoex commented Jul 19, 2021

@calixtus Okay, i will follow the documentation to modify the color of icons, thanks.

@Siedlerchr
Copy link
Member

Just asking, @Joe11028 Have you made any progress? Are there any things where you struggle?

@JJJoex
Copy link
Author

JJJoex commented Jul 31, 2021

Just asking, @Joe11028 Have you made any progress? Are there any things where you struggle?

I got stuck in altering the color of icons that i can change the background color of these buttons but failed to change the color of icons in this figure.
QQ截图20210730101548
I set id for these buttons in fxml file, and then in css file i attempt to change the icon color by modifying '-fx-icon-color' or '-fx-fill', but it doesn't work. So can you offer me some suggestions?

@Siedlerchr
Copy link
Member

@Joe11028 as @calixtus has quoted from the Ikonli documentation, you just need to add this to the end of the Dark.css:
An example (I tested with the light one)
No need to adjust anything in the fxml

.ikonli-font-icon {
	-fx-icon-color: red;
}

grafik

@JJJoex
Copy link
Author

JJJoex commented Aug 2, 2021

@Siedlerchr I add these at the end of base.css and set -fx-icon-color: -fx-text-base-color. Here's the outcome.
QQ截图20210802080601
QQ截图20210802080608
QQ截图20210802080758
QQ截图20210802080808
I think it works, and i gonna open a new PR.

@JJJoex
Copy link
Author

JJJoex commented Aug 2, 2021

@Siedlerchr I've tried to add this in PreferencesDialog.css instead of Base.css, it looks prettier. I think this one is better.

QQ截图20210802081841
QQ截图20210802081849
QQ截图20210802081717
QQ截图20210802081729

@JJJoex JJJoex mentioned this pull request Aug 2, 2021
5 tasks
@calixtus calixtus closed this Aug 2, 2021
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

Successfully merging this pull request may close these issues.

Icons in Entry Edit Window not visible in Dark Mode
3 participants