diff --git a/docs/api-contract.md b/docs/api-contract.md index b6b25f5e..ed5b43f9 100644 --- a/docs/api-contract.md +++ b/docs/api-contract.md @@ -1011,6 +1011,7 @@ rows: readonly T[] center?: boolean children?: JSX.Element horizontal?: boolean +material?: Material vertical?: boolean ``` diff --git a/src/components/_shared/material.css b/src/components/_shared/material.css index 7194695d..c449667f 100644 --- a/src/components/_shared/material.css +++ b/src/components/_shared/material.css @@ -17,10 +17,12 @@ * than tidy. An undefined custom property does not fall back to its initial * value: CSS drops the whole declaration. Three of these used to be read bare, * so a theme that defined twenty-eight of the thirty-one glass tokens got a - * surface with no background at all rather than a plainer one. The two shipped - * themes both use `white` for the three colours, so that is what the fallbacks - * say. `src/styles/glass.ts` derives the rest from `blur`, `refraction` and - * `depth`. + * surface with no background at all rather than a plainer one. The fallbacks + * tint glass with the theme itself: the film is `base-100` and the border + * `base-content`, so glass is the page's own surface made translucent, in any + * theme, rather than a white film laid over it. Highlights stay white, because + * they are light catching an edge. `src/styles/glass.ts` derives the rest from + * `blur`, `refraction` and `depth`. */ @layer components { @@ -71,12 +73,12 @@ :root.glass [data-material="solid"]:not([data-material-explicit]) { background-color: color-mix( in oklab, - var(--glass-background-color, white), + var(--glass-background-color, var(--color-base-100)), transparent calc(100% - var(--glass-background-opacity, 55%)) ); border-color: color-mix( in oklab, - var(--glass-border-color, white), + var(--glass-border-color, var(--color-base-content)), transparent calc(100% - var(--glass-border-opacity, 12%)) ); } @@ -110,12 +112,12 @@ [data-material="glass"] { background-color: color-mix( in oklab, - var(--glass-background-color, white), + var(--glass-background-color, var(--color-base-100)), transparent calc(100% - var(--glass-background-opacity, 55%)) ); border-color: color-mix( in oklab, - var(--glass-border-color, white), + var(--glass-border-color, var(--color-base-content)), transparent calc(100% - var(--glass-border-opacity, 12%)) ); -webkit-backdrop-filter: blur(var(--glass-blur, 9px)) @@ -288,7 +290,7 @@ [data-control-material="glass"] { background-color: color-mix( in oklab, - var(--glass-background-color, white), + var(--glass-background-color, var(--color-base-100)), transparent calc( 100% - @@ -311,7 +313,7 @@ [data-material="glass"] { background-color: color-mix( in oklab, - var(--glass-background-color, white), + var(--glass-background-color, var(--color-base-100)), transparent calc(100% - var(--glass-fallback-background-opacity, 78%)) ); } @@ -321,7 +323,7 @@ [data-material="glass"] { background-color: color-mix( in oklab, - var(--glass-background-color, white), + var(--glass-background-color, var(--color-base-100)), transparent calc(100% - var(--glass-fallback-background-opacity, 78%)) ); -webkit-backdrop-filter: none; diff --git a/src/components/card/Card.css b/src/components/card/Card.css index d4ae4a68..e0abc1e9 100644 --- a/src/components/card/Card.css +++ b/src/components/card/Card.css @@ -109,19 +109,20 @@ initial value: CSS drops the whole declaration. Three of these were read bare, so a theme that defined twenty-eight of the thirty-one glass tokens got a card with no background at all rather than a plainer one, and the - only themes that defined all thirty-one were the two shipped here. Both - use `white` for the three colours, so that is what the fallbacks say. + only themes that defined all thirty-one were the two shipped here. The + film falls back to `base-100` and the border to `base-content`, the same + theme colours `_shared/material.css` uses. `src/styles/glass.ts` derives the other twenty-five from three numbers. */ .card--material-glass { --card-bg: color-mix( in oklab, - var(--glass-background-color, white), + var(--glass-background-color, var(--color-base-100)), transparent calc(100% - var(--glass-background-opacity, 55%)) ); --card-border: color-mix( in oklab, - var(--glass-border-color, white), + var(--glass-border-color, var(--color-base-content)), transparent calc(100% - var(--glass-border-opacity, 12%)) ); -webkit-backdrop-filter: blur( diff --git a/src/components/footer/Footer.layout.tsx b/src/components/footer/Footer.layout.tsx index eee55e22..5ad12b73 100644 --- a/src/components/footer/Footer.layout.tsx +++ b/src/components/footer/Footer.layout.tsx @@ -2,7 +2,8 @@ import "./footer.css"; import type { JSX } from "@solidjs/web"; import {type ParentComponent, omit} from "solid-js"; import { twMerge } from "../../lib/twMerge"; -import type { UIBaseProps } from "../vocabulary"; +import "../_shared/material.css"; +import type { Material, UIBaseProps } from "../vocabulary"; import { FooterTitle } from "./FooterTitle.generated"; import { CLASSES } from "./Footer.recipe"; import type { Layout } from "../../lib/layouts"; @@ -13,10 +14,21 @@ export type FooterProps = UIBaseProps & { center?: boolean; horizontal?: boolean; vertical?: boolean; + /** What the footer is made of. Unset keeps the footer's own background. */ + material?: Material; }; const Footer: Layout = () => { - const others = omit(props, "children", "class", "dataTheme", "center", "horizontal", "vertical"); + const others = omit( + props, + "children", + "class", + "dataTheme", + "center", + "horizontal", + "vertical", + "material", + ); const classes = () => twMerge( @@ -31,6 +43,8 @@ const Footer: Layout = () => {