Skip to content

Fix icon color in dark mode #7917

Closed
JJJoex wants to merge 2 commits into
JabRef:mainfrom
JJJoex:new
Closed

Fix icon color in dark mode #7917
JJJoex wants to merge 2 commits into
JabRef:mainfrom
JJJoex:new

Conversation

@JJJoex

@JJJoex JJJoex commented Jul 18, 2021

Copy link
Copy Markdown

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
Copy Markdown
Member

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

@JJJoex

JJJoex commented Jul 18, 2021

Copy link
Copy Markdown
Author

@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

calixtus commented Jul 18, 2021

Copy link
Copy Markdown
Member

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
Copy Markdown
Member

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

@JJJoex

JJJoex commented Jul 18, 2021

Copy link
Copy Markdown
Author

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

@JJJoex

JJJoex commented Jul 19, 2021

Copy link
Copy Markdown
Author

@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

JJJoex commented Jul 19, 2021

Copy link
Copy Markdown
Author

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
Copy Markdown
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

JJJoex commented Jul 19, 2021

Copy link
Copy Markdown
Author

@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
Copy Markdown
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
Copy Markdown
Member

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

@JJJoex

JJJoex commented Jul 19, 2021

Copy link
Copy Markdown
Author

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

@Siedlerchr

Copy link
Copy Markdown
Member

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

@JJJoex

JJJoex commented Jul 31, 2021

Copy link
Copy Markdown
Author

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
Copy Markdown
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

JJJoex commented Aug 2, 2021

Copy link
Copy Markdown
Author

@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

JJJoex commented Aug 2, 2021

Copy link
Copy Markdown
Author

@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