Re: [csswg-drafts] [css-color-4] Color modifications proposal: extending color functions

I like the idea of working with the syntax we've got, although complicating the arguments of the color functions is starting to make dropping the commas look like a bad idea.

There definitely needs to be some sort of grouping structure, even if it's just a mandatory wrapping `()` without a `calc` prefix, so that you can distinguish addition /subtraction from simply setting the next number in the sequence. And distinguish division from the new syntax of using `/` to separate the alpha channel.

I find the use of the component initials as the placeholder for the starting value more intuitive & easier to read than `_`. But I recognize that there are long-term benefits to having a single token that works in any colour function, especially when you consider custom color systems. But maybe it could be both? The definitive syntax could use a generic placeholder, but allow the letters a synonyms in the common functions?

I like the idea of using a `from <color>` keyword approach, especially when you consider that the color would often be a variable, and some of the parameters may also be variables, so an extra keyword would help in readability.

So, what I'm thinking of is something like this:

```css
rgb(from var(--backdrop), r g b/0.5) /* this is making alpha=0.5, not changing the blueness!*/
hsl(from var(--accent), h (s/2) (l - 20%))
lab(from var(--primary), var(--luminance) a b)
```

Re @birtles musing about an additive mode: we could define it so that the relative adjustments are valid without the `from <color>,` bit. The color could default to transparent black, but in additive mode it could be whatever the base color in the adjustment stack is.


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

Received on Monday, 15 October 2018 04:39:28 UTC