- From: Isiah Meadows via GitHub <sysbot+gh@w3.org>
- Date: Sun, 31 Mar 2019 11:01:37 +0000
- To: public-houdini-archive@w3.org
Could this not use functions and named parameters instead to `registerCustomFunction`? Also, I see a golden opportunity here to call the function with the values as direct parameters since the parameter list is already necessarily static.
```
function registerColorModifier(name, impl) {
registerCustomFunction(name, {
inputProperties: ['--color-space'],
inputArguments: ['<color>', '<percentage-number>'],
returnType: '<color>',
call: impl,
})
}
registerColorModifier("--darker", (styleMap, startingColor, delta) => {
/* convert percentage delta values into numbers */
/* find the correct modifier function based on the color space */
/* return a new CSSColorValue object.
...which first needs to be defined in Typed OM */
})
registerColorModifier("--lighter", (styleMap, startingColor, delta) => {
/* same structure as before, but a different operation */
})
```
It's slightly more boilerplatey, but it simplifies the model a bit and leaves it a bit more streamlined and easy to use, especially when you're defining a *lot* of them.
--
GitHub Notification of comment by isiahmeadows
Please view or discuss this issue at https://github.com/w3c/css-houdini-drafts/issues/857#issuecomment-478331584 using your GitHub account
Received on Sunday, 31 March 2019 11:01:38 UTC