6 ms·
Thanks. Looks hideous. @function --light-dark(--light, --dark) { result: var(--light); @media (prefers-color-scheme: dark) { result: var(--dark); }
by andirk 2y ago
Thanks. Looks hideous.
@function --light-dark(--light, --dark) {
result: var(--light);
@media (prefers-color-scheme: dark) {
result: var(--dark);
}
}
- moron4hire 2y agoYeah, I couldn't believe it at first. If you're going to add imperative programming to CSS, just do it already. Hacking in conditionals in this way feels like a bad joke.
- deleted 2y ago[deleted]
- ehsankia 2y agoThese are closer to macros than functions, especially without css if(). It's nothing that you can't already do.
- deleted 2y ago[deleted]
- sureIy 2y agoLooks decent to me, I understand they have to stay within the normal look of CSS. That function, other than nesting, could every well be parsed by a 20-year-old parser.
- deleted 2y ago[deleted]
- KPGv2 2y agolooks like Racket got high and all its parentheses become wobbly
- librasteve 2y agomakes my eyes hurt
- barrenko 2y agoIt does look like something a Googler came up with.
- mock-possum 2y agoThis looks wrong to me - it looks like it should always return ‘light,’ because the ‘if prefers dark then return dark’ conditional is introduced after the default result Is it more like - result is a variable that can be redefined over and over during the function, and whatever value it is at the end, is what’s returned?