Wot-thing-description: Allow a webthing to provide an icon

Created on 25 Feb 2021  路  7Comments  路  Source: w3c/wot-thing-description

I would like to suggest that there should be a way that a webthing can provide it's own icon that the webthing UI could then use.

PR available

Most helpful comment

I would say that the links container can be used for this. An example would be something like:

...
"links": [{
    "rel": "icon",
    "href": "/favicon",
    "type": "image/png"
}]
...

icon relation type is already registered in IANA: https://www.iana.org/assignments/link-relations/link-relations.xml

All 7 comments

I would say that the links container can be used for this. An example would be something like:

...
"links": [{
    "rel": "icon",
    "href": "/favicon",
    "type": "image/png"
}]
...

icon relation type is already registered in IANA: https://www.iana.org/assignments/link-relations/link-relations.xml

I would say that the links container can be used for this.

That's a cool idea.

The other alternative would be to add an icons member to the Thing Description itself, in the same way that the W3C Web App Manifest specification does. Note that there is already a re-usable image resource specification for this purpose, which the manifest specification uses.

@benfrancis thank you for the pointers :)
Actually, it is nice to indicate the size like they do in the image resource spec. We would definitely need a vocabulary term for that. Other than that, the web app manifest has other keys like orientation, background color etc. I would say that unless we add many new terms about the icons, creating a new container seems not necessary for now. If we do create a container, we can simply reuse the manifest's terms

the web app manifest has other keys like orientation, background color etc. I would say that unless we add many new terms about the icons, creating a new container seems not necessary for now.

Members like orientation, background_color etc. in a web app manifest describe a web app, not an icon.

A web app manifest is to a web app what a thing description is to a web thing. I'm not suggesting we add a web app manifest inside a thing description, only that the Image Resource specification (which was separated out from the Web App Manifest specification for exactly this reason) could be used inside the Thing Description specification as it is inside the Web App Manifest specification.

The Image Resource specification defines only src, sizes and type and could be used inside a Thing Description using an icons member as follows:

...
icons: [
  {
    "href": "icon16.png",
    "type": "image/png",
    "sizes": "16x16"
  },
  {
    "href": "icon32.png",
    "type": "image/png",
    "sizes": "32x32"
  }
]
...

In HTML <link rel="icon"> link relations can have a sizes attribute which supports the same values as the sizes member in the Image Resource specification. The same could be applied inside the Thing Description as follows:

...
"links": [
  {
    "rel": "icon",
    "href": "icon16.png",
    "type": "image/png",
    "sizes": "16x16"
  },
  {
    "rel": "icon",
    "href": "icon32.png",
    "type": "image/png",
    "sizes": "32x32"
  }
]
...

I would support either approach.

Yeah, they both seem equivalent to me. The only thing that might change is that an icons field (and its elements) would be easier to extend. For example, I want to state that iconX can only be used on light themes. However, it is possible to define a link subclass with a dedicated member for the same purpose.

To be consistent with other discussions (https://github.com/w3c/wot-testing/issues/87 ) I'll put my vote on links but I am open to further points.

Another related issue: https://github.com/w3c/wot-thing-description/issues/936

I am a big fan of reuse. So PR #1103 introduce rel=icon and sizes in the links container. Feedback welcome.

icon is in the latest draft

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zolkis picture zolkis  路  5Comments

ToruKawaguchi picture ToruKawaguchi  路  6Comments

mkovatsc picture mkovatsc  路  9Comments

farshidtz picture farshidtz  路  5Comments

benfrancis picture benfrancis  路  8Comments