But depending on the light or dark theme the user is using, the color of this SVG icon should be changed.
I use currentColor in the SVG. But the color is set to black independent of light or dark theme, while the Jira icons are switching their color. See screenshots below with icon from Jira (“Project”) and my own icon (“Manage”)
<path ... style="stroke:currentColor;..."/>
What do I need to do in order to have support for themes in the icon? Is there a CSS class to apply to the SVG maybe? Or use a defined color in the SVG?
Hi @Holger
We have the same problem with all of the svg icons in our app. If you could be able to solve it, we really appreciate it if you could share the solution.
Regards,
I used style="fill:#42526E;" to mimic the default color, but of course this only works for light theme and is not right in dark theme even though at least recognizable.
Using style="fill:var(--ds-text);" or style="fill:currentColor;" does not work. I guess because the SVG is actually loaded via <img src="path-to-svg-file.svg"/> which separates the SVG from the context of the page.
While Atlassian is loading their own icons via embedded SVG with <span><svg ...>...</svg></span> and then currentColor and design tokens can be used…
So it is an issue, how Forge loads the SVG images for the menu icons, why you cannot use design token I guess.
Hi. I also ran into this, so I studied the icon from the JXL plugin and was able to get the following to work for me (after removing fill/stroke styling from my paths, etc):
However, this approach does not work if the user selects the Light or Dark theme instead of “Match Browser” in their personal Jira settings and if their operating system or browser settings differ.
I’m not sure if “Match Browser” is set as the default option. In any case, it would be preferable if the Atlassian Design Team addressed this issue.