Re: [csswg-drafts] [css-values-5] Introduce nth-item() (#11103)

At that point, where you're defining things globally, you might as well define a function anyway and hide away the implementation details.

```css
@function --color(--which type(<custom-ident> | <integer>)) returns <color> {
  result: if(style(--which: lightest): nth-item(1, ...var(--color-accent)),
             style(--which: medium): nth-item(5, ...var(--color-accent)),
             style(--which: darkest): nth-item(10, ...var(--color-accent)),
             else: nth-item(var(--which), ...var(--color-accent))
  );
}
:root {
  --color-accent: ...;
}
```

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


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

Received on Tuesday, 22 July 2025 18:01:48 UTC