Hacker News new | past | comments | ask | show | jobs | submit login
Creating color palettes with the CSS color-mix() function (developer.mozilla.org)
22 points by danielskogly on March 10, 2024 | hide | past | favorite | 1 comment



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%)`




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: