Bug 266440 - Allow CSS Custom Property in mask-icon's color attribute
Summary: Allow CSS Custom Property in mask-icon's color attribute
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P4 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-12-14 14:23 PST by Jordan
Modified: 2024-01-04 09:07 PST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jordan 2023-12-14 14:23:40 PST
It would be nice if this worked:
```
<link rel="mask-icon" color="--my-color" href="https://assets.com/img/safari-pinned-tab.svg">
```

This tag was implemented before WebKit supported custom properties, so I understand why they don't work, but now that WebKit supports them it would be very nice for developers to not have to hardcode and manually maintain this color value. 

I'm opening a ticket for MS to do the same for their `<meta name="msapplication-TileColor" content="--my-color">` tag.

Thanks!
Comment 1 Anne van Kesteren 2023-12-15 01:59:16 PST
This should be standardized first. I recommend opening a new issue against the HTML Standard.
Comment 2 Jordan 2023-12-15 10:22:16 PST
Agreed, but there was a lot hand-wavy talk over there that this is WebKit-only and they may or may not consider changes all depending on WebKit interest and implementation. So I think it needs to start here first.

GH issues regarding changes to mask-icon:
https://github.com/whatwg/html/pull/2230
Comment 3 Jordan 2023-12-15 10:35:06 PST
whatwg feature request https://github.com/whatwg/html/issues/9997

FWIW I would love to contribute this to WebKit, so if there's a willingness to support it I could try to do it.
Comment 4 Radar WebKit Bug Importer 2023-12-21 14:24:13 PST
<rdar://problem/120013002>
Comment 5 Jordan 2024-01-04 09:07:59 PST
Regarding the need to standardize first:

My naive understanding of the spec is that it would actually be appropriate for WebKit to move forward with this addition without waiting for WHATWG. The spec for mask-icon's color says:

"This specification does not have any user agent requirements for the color attribute." (https://html.spec.whatwg.org/multipage/semantics.html#attr-link-color)

My assumption is that's because this is a Safari-only thing, hence WK moving forward with support for Custom Property would be appropriate. It would be a non-proprietary additive feature. It's not too rebellious :)

Regardless, I would like to submit an update to spec the language, but I'm afraid it will land on deaf ears unless WK gives some signal that this would be a welcome update.

The updated spec language I think would be as simple as something like:

*Before*
"The value must be a string that matches the CSS <color> production, ..."

*After*
The value must be a string or CSS Custom Property whose value resolves to a string that matches the CSS <color> production, ..."

Would be happy to help any way I can.