Dynamic icons for text values with spaces in them

I’m trying to get dynamic icons working correctly for the “Condition” value returned by the weather binding.

I’ve specified the icon as condition and in icons/classic I have a “condition.svg” and a bunch of others for specific values. “condition-clear.svg” or “condition-overcast.svg” will work and get correctly used for “Clear” or “Overcast” condition values, but “condition-partly_cloudy.svg” will not get used for “Partly Cloudy”. In that case, I just get the default “condition.svg” icon.

I have not been able to find the proper syntax documented anywhere. From what I’d read, I thought a space in the string would get mapped to an underscore in the file name but that doesn’t work. There are a very large number of possibly conditions returned by the weather binding and most of them have spaces.

What is the correct file name to use?

Maybe you can find the solution in this thread (although I did not read through it …):

Unfortunately, that thread doesn’t have the answer.

Hmm…if all else fails, you could try creating a helper (or proxy) item and use that on the sitemap.
Whenever the “real” weather item changes, via a rule set the helper item to the same string but with the space replaced with “_”. Assign the icon to that Item and you icons should work.
It’s cracking nuts with a sledgehammer, but it should work.

Spaces in icon names might well lead to inconsistencies trying to retrieve/display in different UI environments.

There was an issue raised and dealt with for spaces in the “main” part of teh icon name some years ago. That would not help with spaces in the “after-hyphen” dynamic selection part though, I think

I was able to get this working (for web browser clients) by simply using a space in the file name. For example “condition-mostly cloudy.svg” works.