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

Allow a webthing to provide an icon #1063

Closed
cgerhard opened this issue Feb 25, 2021 · 7 comments
Closed

Allow a webthing to provide an icon #1063

cgerhard opened this issue Feb 25, 2021 · 7 comments
Assignees

Comments

@cgerhard
Copy link

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.

@egekorkan
Copy link
Contributor

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

@benfrancis
Copy link
Member

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.

@sebastiankb sebastiankb self-assigned this Feb 26, 2021
@egekorkan
Copy link
Contributor

@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

@benfrancis
Copy link
Member

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.

@relu91
Copy link
Member

relu91 commented Mar 1, 2021

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 (w3c/wot-testing#87 ) I'll put my vote on links but I am open to further points.

Another related issue: #936

@sebastiankb
Copy link
Contributor

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

@sebastiankb
Copy link
Contributor

icon is in the latest draft

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants