Closed metbril closed 5 years ago
classic name (alias) |
ESH cat |
classic icon | material name | material icon |
---|---|---|---|---|
alarm (siren) |
yes (no) |
alarm-light | ||
battery | yes | battery | ||
blinds | yes | blinds | ||
colorlight | yes | palette | ||
contact | yes | x | ||
dimmablelight | yes | lightbulb | ||
carbondioxide | yes | x | ||
door | yes | glassdoor | ||
energy | yes | power | ||
fan | yes | fan | ||
fire | yes | fire | ||
flow | yes | waves | ||
garagedoor | yes | garage | ||
gas | yes | gas-cylinder | ||
house | no | home | ||
humidity | yes | water-percent | ||
light (slider, dimmablelight) | ? | lightbulb | ||
motion | yes | run-fast | ||
movecontrol | yes | cursor-move |
x | ? | | x | x | ? | | x | x | ? | | x |
Here's the list of all ESH icons in the format proposed by @rtvb: Easily manageable Markdown table is also available on my Gist
Sometimes the _1, _2, _3 etc or on / off are mapped to the same icon is that a useful and wise?
@martinvw it's a work in progress. I didn't find an alternative state so left the icon as it is. Feel free to contribute.
👍
@all if anyone's interested, here's the whole Material iconset mapped to Classic: classic.zip
I think it looks decent:
To use that, simply unpack the content into your /openhab-config/icons/classic
.
I simply downloaded Material icons svg
folder and placed iconconvert.bat file there. Then I simply run the script so it's copied with the proper name.
Awesome work @kubawolanin. I haven't had much time lately so thanks for the mapping. I have some suggestions for alternatives. And I had already built a script to convert to svgs to colored versions for example for the lightbulb in use with a percentage.
@rtvb that's awesome! Sure, any suggestions are welcome! I'm thinking of setting up a new iconset bundle project for these. Would you be interested in cooperating? The way I see it is that we would include all mappings for covering ESH icons + we would include more home automation related ones. This way we'll have a nice superset of material icons. How does it sound? ;-)
Cheers!
Sounds awesome :-)
The license is SIL Open Font License 1.1. I will have to check with Eclipse Legal, but at a first glance it looks fair and I would hope it is compatible with the EPL, so that we could add such an iconset bundle directly to ESH.
I have created a repo with my conversion script. I have not added @kubawolanin 's icon mapping. Feel free to create a PR if you like.
https://github.com/metbril/openhab-mdi
Update: I have added the selected set from @kubawolanin to the repo. It needs some tuning, but it's available.
I've made a simple script that adds a round background to all these icons. What do you think about these icons: (Colors are Material colors)
@kaikreuzer Should new icon sets have exact the same icons than "classic" or can they have more or less?
@mueller-ma I like the background color, but how would we use dynamic icons with different colors for different Item values?
@metbril I took each color from here https://material.io/guidelines/style/color.html#color-color-tool (500 or the brightes one with white text color) and than choose a random color for each item group, e.g. all window icons. I wouldnt use different colors for different states. There should be in most cases a "off" mdi. But we could use different colors for boy-1, boy-2, etc.
I think your scripts are far better, so can you try to implement the background?
I think it might be good to hardcode background color for some items, e.g. Android always green
@mueller-ma the icons look nice with the round colored background. For PaperUI however I guess the background should be generated by CSS and background color set dynamically. For the icon set I would recommend to only add the raw icons and let the different UIs decide on how to provide background (if any).
@htreu I dont really like this idea. Icons should be the same on all clients.
Hey @metbril and @kubawolanin, thanks again for this gorgeous work!
Should new icon sets have exact the same icons than "classic" or can they have more or less?
That's something that wasn't cleanly defined so far, so I spent the last week to sort this out. You can find the result at https://www.eclipse.org/smarthome/documentation/features/ui/iconset/classic/readme.html.
So all icons that are listed there are considered mandatory for every iconset (while some are even still missing in the Classic Iconset). The only exception are "Other Icons" - these are the ones that the Classic Icon set has on top, but which is not required/standardised.
@kubawolanin It would be cool if you could adapt the mapping to these names!
With this, we should create a PR for an Material Iconset OSGi bundle, which should be similar to https://github.com/eclipse/smarthome/tree/master/extensions/ui/iconset/org.eclipse.smarthome.ui.iconset.classic. We could create it for a start in openhab2-addons, but the goal should be to have it at ESH, so that the Paper UI can make use of it as well. I haven't clarified the license issue yet, I will start this discussion right away now.
For the icon set I would recommend to only add the raw icons
Looking at this screenshot, I would say that the "raw" version even looks good for the Basic UI. But obviously, they would not work for dark themes.
I guess the background should be generated by CSS and background color set dynamically.
@htreu What about the foreground color, could/should that also be defined by the client? If we would want to head that way, we should define the iconset to ONLY provide SVGs, because with PNG we couldn't make this work. The other option is that we make the iconset bundle register different icon sets, e.g. a "light", a "dark" and a "colored" version. In that case, it would be up to the bundle to adapt the SVGs before delivering them to the client - and we could decide there, whether we want colored circles in the background or not.
The other option is that we make the iconset bundle register different icon sets, e.g. a "light", a "dark" and a "colored" version. In that case, it would be up to the bundle to adapt the SVGs before delivering them to the client - and we could decide there, whether we want colored circles in the background or not.
I find this option very interessting. Espacially that different clients can use different themes and get some good looking icons. That's one reason why I still use the bright theme on Android, because some classic icons don't have enough visual difference from a dark background. Should the client draw the background or set a parameter in the GET request to get an icon with background?
we should define the iconset to ONLY provide SVGs
I would prefer it this way. The icon size, color and background should be a decision made on the client. The size might depend on the screen size and with SVGs you can scale without quality loss. The color may depend on the item state, the client theme and cultural interpretation. The background again is a matter of information design. The framework should deliver icons in the most neutral way so clients can adopt whatever style is required. In web ui this is common practice when delivering icon fonts. Here every icon is just an SVG which describes its contour, just like letters in a normal font. Scaling and coloring is up to the client.
@htreu Please note that this isn't a perfect fit for our icon infrastructure, though - a client is expected to ask for the icon for a specific state as well. So e.g. coloring a bulb to match a certain HSB state should ideally be done by the runtime and not by the client - this way we can easily provide this feature to all clients at once instead of requiring them to individually implement this.
Should the client draw the background or set a parameter in the GET request to get an icon with background?
No, clients have no way to pass additional wishes besides the iconset id. That's why I said that the iconset bundle should register different iconset ids for different versions.
okay, tnx for the additional information. With icons in SVG format we could easily have both: The UI could request icons for a specific state and will be provided with the colored version. There is still the option to re-color the icon or retrieve it raw and do the coloring client side. That said we gain the most flexibility when delivering SVGs. And for the state dependent request it should be feasible to render colored versions in the framework. This will ensure the same (color) result regardless of the provided icon.
edit: we should think about proper caching then...
clients have no way to pass additional wishes besides the iconset id
Can this behavior be changed?
@mueller-ma what is the purpose of querying an icon with the background already rendered? I think placing an icon on some specific background is up to the client because this a very design/ui targeted decision. In case we would serve icons with a background pre-rendered I doubt this would fit a lot of clients (except the one the backgrounds where designed for). Should the background be squared, round, which diameter, should the icon throw a shadow? Clients can address this very easily, the framework does not.
@htreu Less duplicate code in the clients
IMO some icons should have a specific background color, e.g. Android = green. How can this be achieved?
I've put some work in the script by @metbril, so it now generates mostly all icons needed. The zip file contains 4 folder with different color modes:
I would like to hear your feedback
openhab-mdi.zip Code: https://github.com/mueller-ma/openhab-mdi
Not all icons are currently available, but there are PRs for most of them. Black: Combined: Random: State:
I really like what @mueller-ma has achieved with my initial effort. Hopefully this will become a standard feature of openHAB in the future.
@kaikreuzer How should the icons be intergrated in esh? For the classic icon set there are a few sh scripts that convert the icons to png and create aliases. The script by @metbril is written in python and includes the original icons as subrepo. Should the script or the generated icons be included?
I have a question about random
and combined
(in random mode). Does it mean the colors of the items are randomly chosen? So maybe an ON
state icon will be red vs. an OFF
state icon may be green?
Random means the icon colors are completly random, so ON
could be red.
Many icons (e.g. garden, house, etc.) don't have icons for special states, so they are black by default. To color them the mode combined
can be used. In combined mode on
will be green, off
will be red (some other icons have a hardcoded color, e.g. android is always green) and for all icons without state a random color will be choosen.
I wouldn't want to include random
, maybe combined
, state
, black
and white
!?
I want to summarise my opinion on this issue:
from https://github.com/openhab/openhab2-addons/issues/2139#issuecomment-331102810
What about the foreground color, could/should that also be defined by the client? If we would want to head that way, we should define the iconset to ONLY provide SVGs, because with PNG we couldn't make this work.
Thats the way I strongly suggest. Otherwise:
we make the iconset bundle register different icon sets, e.g. a "light", a "dark" and a "colored" version.
... and the client then has to adopt its whole color theme to the backend defined color set. From an UI pov this is not an option! Fonts are delivered w/o colors for good reasons. And so should icons!
from https://github.com/openhab/openhab2-addons/issues/2139#issuecomment-331398228
So e.g. coloring a bulb to match a certain HSB state should ideally be done by the runtime and not by the client
I'm sorry @kaikreuzer but I disagree. It's not in the backends responsibility and a client could also decide not to color an icon at all. For the HSB state it would actually be a nice move from the backend to also provide some RGB values :-)
The frontend should be well aware of the items state for which an icon is requested. For all HTML5 clients its easy to apply colors by JavaScript. For other UIs capable of handling SVG I assume the same. For everything else (which should not be much) there will be PNGs.
I suggest this PR to provide SVG (uncolored) and PNG in the already known color versions.
I suggest this PR to provide SVG (uncolored) and PNG in the already known color versions.
This way the png files wouldn't match the svg files like in the classic icon set.
Can a client request a specific icon set or check which icon set is used?
Can a client request a specific icon set
Yes, every request to the backend icon provider can include the iconset
request parameter which tells the name of the iconset. If not given this falls back to classic
.
Is there actually any reason why this iconset SHOULD support PNG? Afaik, all our clients meanwhile support SVG. Note that iconsets can declare, which formats they support, so PNG is not mandatory.
So e.g. coloring a bulb to match a certain HSB state should ideally be done by the runtime and not by the client
I'm sorry @kaikreuzer but I disagree. It's not in the backends responsibility and a client could also decide not to color an icon at all.
Then let me disagree with your disagreement, @htreu. With the generic approach that we follow, clients are not supposed to have any clue about what they are rendering. Therefore they normally should not be in any better position than the runtime to decide how to color an icon. I don't say that it never must do it - if it wants to support certain standard categories in a nicer way, it can always request the "plain" icon and do the coloring itself (if it knows how).
@kaikreuzer How should the icons be intergrated in esh?
First of all, thanks for all your efforts, it looks great! I am wondering, if we shouldn't put the logic in the iconset bundle as suggested above, i.e. we only have the "raw" svgs as resources and have the bundle adapt the delivered svg according to the requested state and theme (so more or less what the python script is currently doing as a manual pre-process).
I am wondering, if we shouldn't put the logic in the iconset bundle as suggested above, i.e. we only have the "raw" svgs as resources and have the bundle adapt the delivered svg according to the requested state and theme (so more or less what the python script is currently doing as a manual pre-process).
I think that's the best way to do it. When the icon color is generated at runtime, it will be much easier to provide icons for all states (e.g. on=green, off=red). For some icons the color should be hardcoded in the bundle, e.g. light-off is black and light-on is yellow.
Should we close this? If anybody is doing a PR to add more icon sets that's fine but why keeping this Issue open?
This issue has been mentioned on openHAB Community. There might be relevant details there:
https://community.openhab.org/t/dynamic-icons-not-updating-when-color-item-state-changes/120645/8
Following the forum thread, I'm proposing an icon set that uses material design icons. Depending on the license (IANAL) we can include it in openHAB or Eclipse SmartHome.
Classic icons can be browsed here: https://github.com/eclipse/smarthome/tree/6dd1df77136a70ec55da6746be05bf65b78ba15b/extensions/ui/iconset/org.eclipse.smarthome.ui.iconset.classic/icons Material icons can be browsed here: https://github.com/Templarian/MaterialDesign/tree/master/icons/svg