Question: How does FlatSVGIcon dark mode recoloring work?
See original GitHub issueWhen I use a FlatSVGIcon
with fill="#6E6E6E"
(copied from the icons in the demo), it changes color depending on whether the theme is dark or light (I like that). When I use fill="#000000"
, it does not. When I download a raw Material icon that doesn’t have a fill
specified at all, it is always black. How does it work, what is the underlying mechanism, where is it configured? Is there a documentation for that? Is there a common place where such things are documented (maybe the Demo might be a good spot)?
Thank you.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6
Top Results From Across the Web
Change to dark or color mode on your Android device
On your phone, open the Settings app. Tap Display. Turn Dark theme on or off. Tip: Dark theme can make your screen easier...
Read more >Dark Mode — Working with Color Systems | by Søren Clausen
Since we defined roles for every single color, it's simple to assign new colors to all of the roles, and instantly we will...
Read more >How can I make Photoshop menus dark? - Super User
In the pane on the right you'll see various keys, representing UI elements that can be recolored. Most of them (seemingly) won't work...
Read more >How popular is Dark Mode? | Apple Developer Forums
Does anyone know what percent of iOS user use Dark Mode as their defauklt? ... of lightness and color in my work, so...
Read more >TOPdesk Operator Recoloring - GitHub Pages
You can completely adjust any theme to your needs. See below for instructions on how to customize the theme to your liking. Default...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
FlatSVGIcon
maps only some colours. They are defined in enum FlatIconColors.The idea is to use only this well defined set of colors in SVG icons and then they are replaced at runtime to dark variants or to other theme colors. Then a single SVG icon (light variant) can be used for dark themes too. IntelliJ Platform uses this mechanism to allow themes to change IntelliJ Platform icons.
The colors are based on IntelliJ Platform Action icons and Noun icons.
You can change/extend the color mapping. Either per icon: see FlatSVGIcon.setColorFilter() Or globally for all icons: see FlatSVGIcon.ColorFilter.getInstance()
@howudodat that is a good solution.
No. IntelliJ themes are converted from JSON files and do not have such a property. In FlatLaf 2.x core themes there are variables, but they are not accessible via UIManager:
https://github.com/JFormDesigner/FlatLaf/blob/e5956900ea5413fc0e879c0a808272b988cc51c5/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLightLaf.properties#L62-L75