Skip to content

Creating color palettes with the CSS color-mix() function

developer.mozilla.org
22 pointsdanielskogly1 comment
On HN

Comments

It's a bit late on a Sunday night for me, but that said..

It strikes me as a bit odd that it automatically assumes you want alpha transparency if the percentages do not sum 100%. I can't say I'd feel like I have some argument for why not. Maybe it's just my gut feeling that is like, transparency is so much more declarative elsewhere like "rgbA". I would have probably guessed it would be white or black by default.

It also strikes me as odd that you have to add a "p2" color/parameter called "transparent" if you just want to make a color a bit transparent. Like if you're going to automatically just force transparency as the default thing to choose for two colors which don't sum as 100%, then why not do something similar here, default the third parameter so I can just do `color-mix(in srgb, blue 20%)`

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.