Opened 3 years ago
Last modified 3 years ago
#20878 new enhancement
Add/Update and harmonize plain vehicle access restriction icons
Reported by: | skyper | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Core | Version: | |
Keywords: | vehicle restriction access plain preset | Cc: | Klumbumbus, DevCharly |
Description (last modified by )
I want to add the transportation mode access icons to some presets but therefor I need:
- more icons
- many icons are missing but they could be taken from traffic_signs from wikicommons
- icons should have the dimensions for proper alignment
- plain icons need some contrast in color to better work with all LaFs.
I tried to add some white outline but as I am far from being an expert in icons and inkscape I want to know if I am on the right way before spending to much time on this. Here are two examples:
old (scaled) | new |
---|---|
Sadly, it does not work, that well:
Opinions, hints, criticism …
Attachments (4)
Change History (9)
by , 3 years ago
Attachment: | foot_outl.svg added |
---|
by , 3 years ago
Attachment: | josm_20878_checkbox_dark_mode.png added |
---|
comparison checkbox (dark mode)
comment:1 by , 3 years ago
Description: | modified (diff) |
---|
follow-up: 3 comment:2 by , 3 years ago
SVG has the concept of currentcolor
allowing to define the color of SVG icons from the outside (via HTML or CSS for websites), see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/color and as an example https://fontawesome.com/icons/canadian-maple-leaf. JOSM/svgSalamander might not yet support this concept, but it could help to solve the light/dark LaF disambiguation.
comment:3 by , 3 years ago
Cc: | added |
---|
Replying to simon04:
SVG has the concept of
currentcolor
allowing to define the color of SVG icons from the outside (via HTML or CSS for websites), see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/color and as an example https://fontawesome.com/icons/canadian-maple-leaf. JOSM/svgSalamander might not yet support this concept, but it could help to solve the light/dark LaF disambiguation.
Now, I understand why I've found completely transparent icons on other projects, lately. Does this work with multiple colors, too?
The problem is visible with other icons in presets, like the platform icon .
In general, contrast is needed for all mappaint icons. The tower icon e.g. could profit from contrasts, as depending on the background, it is often not easily visible.
As far as, I understand the concept, it might be helpful to use areas with fill for the solid icons, then the stroke could be used for the contrast. Maybe, I just have to play around with existing icons, a little bit more. One of my problems is that the icons display well in my image viewer (eog) and with the metal LaF but not in dark mode.
I guess, for now, I will start to create the missing plain transportation mode icons without outline.
comment:4 by , 3 years ago
There are various ways to have icons that work in light and dark themes:
- use color that work in both themes (e.g. gray), which is always a compromise and does not work that well
- create two icons: one for light themes and one for dark themes (e.g. named
_dark.svg
) - create icon for light theme and filter colors (while painting) to create dark icon
Approach 2) is easy to add and does not affect existing SVG icons.
Implementing approach 3) in a central icon loader/painter class would affect all SVG icons.
To filter colors, you can map fixed colors (e.g. black to white; darkGray to lightGray).
Then the SVG icons have to use only those colors. Maybe hard to use in JOSM which has already thousands of SVGs.
Another way would be to compute color with some magic (e.g. using HSB or HSL color space).
In FlatLaf Extras subproject, I use approach 3) with a fixed set of icon colors (from JetBrains):
https://jetbrains.design/intellij/principles/icons/#action-icons
For mapping those colors while painting, I use a Graphics2D
proxy class:
https://github.com/JFormDesigner/FlatLaf/blob/main/flatlaf-core/src/main/java/com/formdev/flatlaf/util/Graphics2DProxy.java
and override Graphics2D.setColor(Color)
and Graphics2D.setPaint(Paint)
:
https://github.com/JFormDesigner/FlatLaf/blob/439e63b52f42970572f27449cb48e722cce99288/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/FlatSVGIcon.java#L783-L793
This works very good with svgSalamander.
BTW to detect whether FlatLaf dark theme is active you can use (without dependency to FlatLaf library):
boolean dark = UIManager.getBoolean( "laf.dark" );
comment:5 by , 3 years ago
For presets both solutions, 2) and 3), should work. With mappaint I still see no solution but having icons with enough contrast and/or tiny additional outline as the layer is independent of the visible imagery layers.
Regarding the transport mode icons, I could use 2) and create icons with a light metallic silver instead of black. I have no clue, though, what is needed to be done behind the curtain to deliver these additional icons and replace them if needed.
foot with outline 24x24