w3c / manifest

Manifest for web apps
https://www.w3.org/TR/appmanifest/
Other
659 stars 161 forks source link

Clarify the purpose of `purpose: badge` #808

Closed NotWoods closed 5 years ago

NotWoods commented 5 years ago

The badge purpose is defined as an image to show where "space constraints and/or color requirements differ from those of the application icon". This description is really unclear for both browsers and developers.

The original badge issue (#480) suggested showing the badge in notifications. The web notifications API does already have badge support, but there are other instances where a notification is shown on behalf of the web app. For example, Chrome and Firefox display a site controls notification when a PWA is open.

Site controls notification

badge icons could potentially be displayed instead of a generic icon.

Badged site controls notification

Shortcut icons may also need a way to define a specialized icon and badge could potentially be used there if better defined.

I think a good definition to move towards would be that badge corresponds to a monochrome icon, where only the alpha channel is used by the user agent. Colors would be ignored. This behaviour is similar to how Android treats a notification icon asset.

Monochrome icons are used in a couple different browsers already. Safari has pinned tabs on the touchbar using the mask-icon name. Screen Shot 2019-10-03 at 11 49 11 PM

Windows 8 and 10 usually shows white icons on a colored background for tiles in the start menu. w8_home_screen

It might be best to rename badge to monochrome (or something else) in this case. This would match how maskable is named after the asset type, not where the asset is used.

mgiuca commented 5 years ago

Thanks @NotWoods . This is a really good summary with examples and screenshots on different platforms.

I think this is a dupe of #795 where there's already been a fairly lively discussion including my rough proposal for a more specific spec for "badge". I also would be open to renaming it to monochrome (or just adding a new monochrome purpose) since that's how I'd like this to be used.

Shall we continue discussion on #795?

NotWoods commented 5 years ago

My impression is that #795 refers to only shortcuts while this issue refers to the badge/monochrome purpose. (Although there's been discussion for specifically badge in that issue.) The 3 scenarios above are all examples of where badge could be used that are not shortcuts.