#custom-properties

[ follow ]
fromdaverupert.com
1 week ago

Using your design system colors with contrast-color()

One predictable pain point with contrast-color() is that it only returns black and white named colors. From a design systems perspective, that's not ideal because you want your colors. You want your harmonious brand and the colors you and your team spent thousands of man hours in meetings deciding on. Those colors. In fact, an earlier version of Safari had color-contrast() (confusing I know, naming is hard) which allowed you to pass in a list of best candidates to choose from. I beleive that proposal got mired in standards discussions, color contrast algorithms, and competing proposals; and contrast-color() is what survived which got simplified down to a binary result.
#css
fromLeanrada
9 months ago
UX design

Minimal CSS-only blurry image placeholders

Using a single CSS custom property can create low quality image placeholders effectively without markup clutter.
fromFrontendmasters
9 months ago
UX design

Using currentColor in 2025

currentColor is a foundational CSS variable that simplifies color management, but custom properties are now favored for their clarity and versatility.
fromCSS-Tricks
2 months ago

The Range Syntax Has Come to Container Style Queries and if() | CSS-Tricks

The range syntax isn't a new thing. We're already able to use it with media queries to query viewport dimensions and resolutions, as well as container size queries to query container dimensions. Being able to use it with container style queries - which we can do starting with Chrome 142 - means that we can compare literal numeric values as well as numeric values tokenized by custom properties or the function.
Web development
Web development
fromLogRocket Blog
3 months ago

CSS @function: Dynamic logic without Sass or JavaScript - LogRocket Blog

CSS @function enables dynamic, reusable logic and conditional computations inside stylesheets, reducing reliance on Sass and JavaScript utilities.
[ Load more ]