Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BasicUI] iconcolor does not influence currentColor with color-scheme:light dark #2240

Closed
dilyanpalauzov opened this issue Dec 28, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@dilyanpalauzov
Copy link

I have this file under openhab/icons/classic/on.svg:

<svg xmlns="http://www.w3.org/2000/svg" width="100mm" height="100mm" viewBox="0 0 100 100" style="color-scheme:light dark">
  <text xml:space="preserve" x=".359" y="97.504" style="font-size:130.528px;fill:currentColor;stroke-width:.264583"><tspan x=".359" y="97.504" style="font-size:130.528px;stroke-width:.264583">O</tspan></text>
</svg>

and an element in sitemap:

Default item=CPU_Uptime icon="oh:classic:on"

Essentially it shows a black O in light mode, and a white O in dark mode by using fill:currentColor.

I change the element to

Default item=CPU_Uptime icon="oh:classic:on" iconcolor=[e1==ON="green",e1==OFF="red","blue"]

I would expect that now the color of the O is green, red or blue. In BasicUI it is still white or black, while Android-Openhab shows it coloured.

BasicUI shall display the O coloured, too.

@dilyanpalauzov dilyanpalauzov added the bug Something isn't working label Dec 28, 2023
@lolodomo
Copy link
Contributor

Did you enable the "inline SVG" setting ?

@dilyanpalauzov
Copy link
Author

The description of Inline SVG is:

If enabled, any SVG icon provided by the openHAB icon server will automatically be converted to an inline SVG in the WEB page, allowing control of its color with the sitemap widget property "iconcolor" in the case where the SVG icon sets "currentColor" as the fill color. Note that this will work with custom SVG icons but not with all the packaged icons from the classic iconset since they are defined with a hard-coded color palette. This feature is disabled by default.

After I enabled it, the icon colours were applied.

As the description does not contain any drawbacks for Inline SVGs the user (I) cannot anticipate any reasons why not to enable it. Please either extend the above description to include pro- and contra of enabling the option, or remove the option and always enable Inline SVGs.

@lolodomo
Copy link
Contributor

The advantage is the ability to control the color for icons compatible with that feature. Classic iconset from OH does not support that feature.

The disadvantages are non standard additional treatment to load SVG images, bigger page size (SVG images are then inside the page) and I am not 100% sure that the browser cache is fully working.

My advice is to not enable it except you really want to control icon color and you use icons supporting that feature.

I will try to enhance a little the description.

@lolodomo
Copy link
Contributor

I should also mention that material/framework7/iconify icons are not concerned.
I could replace the last sentence by: This feature is disabled by default due to additional non-standard processing required leading to a larger page size and because it is unnecessary if you only use Material/framework7/iconify icons or openHAB icons from the classic icon set.

lolodomo added a commit to lolodomo/openhab-webui that referenced this issue Dec 30, 2023
In order to explain the default value.

Related to openhab#2240

Signed-off-by: Laurent Garnier <[email protected]>
kaikreuzer pushed a commit that referenced this issue Jan 2, 2024
In order to explain the default value.

Related to #2240

Signed-off-by: Laurent Garnier <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants