Re: [csswg-drafts] Proposal: Custom CSS Functions & Mixins (#9350)

Note that 'pre-filling some values in the cascade' is already fairly approachable, without the function itself cascading. In this case, the cascading variables are available at the call site, and the function will use them when parameters are not defined.

```css
@function --to-canvas(--color, --mix-param: initial, --canvas-param: initial) {
  result: color-mix(
    in oklch, 
    var(--color), 
    var(--canvas-param, var(--canvas, Canvas)) var(--mix-param, var(--canvas-mix-default, 50%))
  );
}

.callout {
  --canvas: white;
  --canvas-mix-default: 25%;
  background: --to-canvas(var(--brand));
}
```


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


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

Received on Monday, 2 June 2025 21:22:02 UTC