Re: [csswg-drafts] [css-link-params] Let’s fix icons on the Web! Aka a way to pass currentColor and other context to linked SVGs (#9872)

I really like the idea  of integrating this with link-params, but I'm not totally sure I've followed the mechanism that's proposed here.

link-params allow a _source_ document to set a variable in the _target_ document, with the value is passed through to the target document as if the variable were set in a user-agent stylesheet (or any equivalent process resulting in the rules having lower priority than any rules set in the target)

```
Properties in the source document
------------------
link-parameters: param(--foo x);

Effective new user-agent stylesheet in the target document
------------------
:root { --foo: x }
```
And if `x` is missing in the `param()`, it defaults to the value the same variable in the source document; so `var(--foo)`


If I understand this proposal, the idea is to extend this so if the parameter name is not a custom-ident,  it's parsed as a CSS property name and the default value is the source element's computed value of that property.

```
Properties in the source document
------------------
font-family: serif
link-parameters: param(font-family);

Effective new user-agent stylesheet in the target document
------------------
:root { font-family: serif }
```

Is that correct? I like it if so, easy to use and no harder to implement than regular link-params. Two questions:

* wouldn't it be `param(color)` not `param(currentcolor)` in this case?
* I presume when passing through a `font-family` that refers to downloaded fonts, the idea is that the target document also inherits any `@font-face` rules that define the family?




-- 
GitHub Notification of comment by faceless2
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9872#issuecomment-2016522754 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Saturday, 23 March 2024 15:18:39 UTC