Modify

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 skyper)

I want to add the transportation mode access icons to some presets but therefor I need:

  1. more icons
    • many icons are missing but they could be taken from traffic_signs from wikicommons
  2. icons should have the dimensions for proper alignment
  3. 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
source:trunk/resources/images//presets/vehicle/restriction/plain/foot.svg foot with outline 24x24
source:trunk/resources/images//presets/vehicle/restriction/plain/bicycle.svg bicycle with outline 24x24

Sadly, it does not work, that well:

comparison of checkbox (metal) comparison checkbox (dark mode)

Opinions, hints, criticism …

Attachments (4)

foot_outl.svg (5.1 KB ) - added by skyper 3 years ago.
foot with outline 24x24
bicycle_outl.svg (4.9 KB ) - added by skyper 3 years ago.
bicycle with outline 24x24
josm_20878_checkbox_metal.png (5.7 KB ) - added by skyper 3 years ago.
comparison of checkbox (metal)
josm_20878_checkbox_dark_mode.png (6.7 KB ) - added by skyper 3 years ago.
comparison checkbox (dark mode)

Download all attachments as: .zip

Change History (9)

by skyper, 3 years ago

Attachment: foot_outl.svg added

foot with outline 24x24

by skyper, 3 years ago

Attachment: bicycle_outl.svg added

bicycle with outline 24x24

by skyper, 3 years ago

comparison of checkbox (metal)

by skyper, 3 years ago

comparison checkbox (dark mode)

comment:1 by skyper, 3 years ago

Description: modified (diff)

comment:2 by simon04, 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.

in reply to:  2 comment:3 by skyper, 3 years ago

Cc: DevCharly 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 source:trunk/resources/images/presets/transport/platform.svg.
In general, contrast is needed for all mappaint icons. The tower icon source:trunk/resources/images/presets/tower/tower.svg 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.

Last edited 3 years ago by skyper (previous) (diff)

comment:4 by DevCharly, 3 years ago

There are various ways to have icons that work in light and dark themes:

  1. use color that work in both themes (e.g. gray), which is always a compromise and does not work that well
  2. create two icons: one for light themes and one for dark themes (e.g. named _dark.svg)
  3. 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 skyper, 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.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain team.
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from team to the specified user.
Next status will be 'needinfo'. The owner will be changed from team to skyper.
as duplicate The resolution will be set to duplicate. Next status will be 'closed'. The specified ticket will be cross-referenced with this ticket.
The owner will be changed from team to anonymous. Next status will be 'assigned'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.