Re: [csswg-drafts] [css-images?] A way to pass currentColor and other context to linked SVGs (#9872)

> I think this is a good idea, but it could benefit from hewing more closely to my Params proposal:
> 
> 1. You might want to set the currentcolor/etc to _a specific_ value, not just what's defined on the element. So the function should allow an optional value after each keyword. So like `src("icon", with(currentcolor red, font-size 20px))`.
and
> Maybe we can just merge this _into_ the Params proposal, so you have a set of predefined _non-dashed_ param names you can use, in addition to using dashed idents to set variables.

The main motivation for this proposal was for it to be a quick win, something that can be implemented more easily than the full-blown params proposal.
As long as tying it to the params proposal doesn't negate that, I think it’s a good idea to integrate them more closely to avoid the cognitive overhead on users of having to learn two distinct syntaxes for highly related things.

> 2. There should be a way to trigger this via url as well, so you can use it in `<img src="icon.svg">`.

Agreed but this seems like a whole different feature (and far more complicated to define in a way that doesn't clash with existing params). 
 
> (Then we can also make the value after the dashed param name optional, defaulting to taking the value of the same-named variable on the element, for cases where that name matches up.)

I love this!

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


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

Received on Sunday, 28 January 2024 19:36:58 UTC