@boyernick/standard-ui-tokens 0.3.0 → 0.3.1-canary.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/css/tokens.css +29 -0
- package/package.json +1 -1
package/css/tokens.css
CHANGED
|
@@ -597,6 +597,35 @@
|
|
|
597
597
|
--text-2xs--letter-spacing: 0em;
|
|
598
598
|
}
|
|
599
599
|
|
|
600
|
+
/* Glass — a translucent surface that takes its colour from whatever is behind
|
|
601
|
+
it. One utility rather than a variant per context: the tint legitimately
|
|
602
|
+
differs (app chrome sits on the page, a video control sits on arbitrary
|
|
603
|
+
footage, a lightbox control sits on the inverted backdrop) but the rule they
|
|
604
|
+
share does not. Set `--glass-tint`, `--glass-opacity` and `--glass-blur` at
|
|
605
|
+
the call site; everything else is the material.
|
|
606
|
+
|
|
607
|
+
`prefers-reduced-transparency` is the reason this is a utility at all. Seven
|
|
608
|
+
surfaces in this library hand-rolled a tint and a blur, and none of them fell
|
|
609
|
+
back for a reader who has asked the system to stop making things see-through.
|
|
610
|
+
Here it is one rule, applied once, and impossible to forget.
|
|
611
|
+
|
|
612
|
+
Blur is expensive to paint. This belongs on floating chrome — bars, badges,
|
|
613
|
+
controls — not on ordinary surfaces. */
|
|
614
|
+
|
|
615
|
+
@utility glass {
|
|
616
|
+
background-color: color-mix(
|
|
617
|
+
in oklab,
|
|
618
|
+
var(--glass-tint, var(--background-primary)) var(--glass-opacity, 80%),
|
|
619
|
+
transparent
|
|
620
|
+
);
|
|
621
|
+
backdrop-filter: blur(var(--glass-blur, 12px));
|
|
622
|
+
|
|
623
|
+
@media (prefers-reduced-transparency: reduce) {
|
|
624
|
+
background-color: var(--glass-tint, var(--background-primary));
|
|
625
|
+
backdrop-filter: none;
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
|
|
600
629
|
/* Headings lg → 2xl: sans + serif variants. md/sm/xs: sans. */
|
|
601
630
|
|
|
602
631
|
@utility heading-2xl-sans {
|