[csswg-drafts] [css-font-loading] [info discovery] iterable doesn't tell you what index you are (#6593)

litherum has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-font-loading] [info discovery] iterable doesn't tell you what index you are ==
One natural use case use case of the information discovery facilities in css-font-loading would be "I want to swap the green color in my palette to my custom color." Doing this requires 2 steps:

1. Iterating over the colors in the palette until you find green
2. Creating a `@font-palette-values` rule that maps the index of green to your new custom color

The trick here is "index" of green. When you iterate through an `iterable`, it doesn't tell you what index you're at. So, if you want to determine what index green lies at, you have to track that yourself.

You can do this with a 3-clause for loop, and `getter`, but maybe we can do better here.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6593 using your GitHub account


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

Received on Friday, 10 September 2021 19:06:30 UTC