VisorVisor
Themes

Glass

One switch for glass over a photo. Off on a plain page, on where a photo sits behind.

Glass is a switch, not a theme. A plain page gets solid surfaces and borders. Where a photo sits behind part of a page, set data-glass="on" on that container and the components inside draw a see-through fill, a blur of the photo, a soft edge and a lift instead. A theme says what its glass looks like in each tone; the switch says where it shows.

The Five Looks

The same card and control on the theme picked in the docs, in each look. Today is the theme as it ships, in the docs site's own mode. Dark and Light force a mode. Only the two Photo looks turn glass on. The photos are real ones, a night photo behind Dark + Photo and a daytime one behind Light + Photo, which a private theme ships next to its YAML (photos/dark.* and photos/light.*). Form controls in the Photo looks sit on a glass form panel, never straight on the photo. A public build without the private themes shows a stand-in gradient instead, so the public repo ships no client photos.

Today
Dark
Dark + Photo
Light
Light + Photo

Turning Glass On

Glass is off unless an ancestor turns it on. The nearest switch wins, so a subtree can turn it back off:

<main>                          <!-- off: solid surfaces -->
  <section data-glass="on">     <!-- on: a photo sits behind this section -->
    <article>…</article>        <!-- glass -->
    <aside data-glass="off">…</aside>  <!-- solid again -->
  </section>
</main>

A PhotoBackdrop turns glass on for the element that holds it as a direct child, so a page that draws its photo with one needs no attribute. With no photo it renders nothing, and glass stays off.

With glass off, nothing that reads the glass layer renders a backdrop-filter. Modal scrims (Dialog, Sheet, Lightbox) keep their own blur: they blur the page under a modal, not a photo.

Put the switch at or inside the element that sets the light/dark mode. The switch resolves the theme's glass values for the tone in force where it sits.

Binding Glass in a Theme

A theme binds the glass family under components. Every key takes one value for both tones or { light, dark }. A theme that binds nothing gets the Visor defaults, lifted from Honcho's glass card.

components:
  glass:
    fill:
      light: "color-mix(in srgb, #0b0b0c 5%, transparent)"
      dark: "color-mix(in srgb, #ffffff 5%, transparent)"
    blur: "blur(32px) saturate(110%)"
    edge: "color-mix(in srgb, #ffffff 25%, transparent)"
    lift:
      light: "rgb(255 255 255 / 0.45)"
      dark: "transparent"
    ink: "#ffffff"
    control-fill:
      light: "rgb(255 255 255 / 0.14)"
      dark: "rgb(255 255 255 / 0.14)"
    control-hover-fill: "rgb(255 255 255 / 0.24)"
    control-ring: "rgb(255 255 255 / 0.16)"
    control-ink: "#ffffff"
    control-blur: "blur(16px)"
KeyWhat it setsVisor default
fillGlass surface fillcolor-mix(in srgb, var(--text-primary) 5%, transparent)
blurFilter on the photo behind a surfaceblur(32px) saturate(110%)
edgeEdge colour, blended soft-lightcolor-mix(in srgb, var(--text-primary) 25%, transparent)
liftWhite laid over the filltransparent
shadowSurface shadowvar(--shadow-xl)
inkText on glassvar(--text-primary)
scrimDark glass under white labels on a photo, in dark modergb(0 0 0 / 0.55)
scrim-inkLabel colour on the scrim, in dark mode#ffffff
ink-shadowShadow under the scrim ink, in dark mode0 0 10px rgb(0 0 0 / 0.55), 0 1px 3px rgb(0 0 0 / 0.5)
control-fillGlass control fillcolor-mix(in srgb, var(--text-primary) 14%, transparent)
control-hover-fillGlass control fill on hovercolor-mix(in srgb, var(--text-primary) 24%, transparent)
control-ringGlass control ringcolor-mix(in srgb, var(--text-primary) 16%, transparent)
control-inkGlass control icon and labelvar(--text-primary)
control-blurFilter behind a glass controlblur(16px)

The percentages are the Honcho kit's, kept as intentional values.

For Component Authors

Read the switch's variables, never the theme's --glass-* values: those are set on every page, and the switch's are set only where glass is on. Each one falls back to the solid look.

VariableSet under data-glass="on" to
--glass-on-displayblock, to show the glass layers
--glass-on-cleartransparent, to clear the host's solid surface and border
--glass-on-<key>the theme's --glass-<key>, or the Visor default, for every key above

A surface draws its glass on sibling layers, so fields inside it can still blur the photo:

.card {
  position: relative;
  background: var(--glass-on-clear, var(--surface-card));
  border: var(--stroke-width-thin) solid var(--glass-on-clear, var(--border-default));
  color: var(--glass-on-ink, var(--text-primary));
}
.glass, .edge {
  display: var(--glass-on-display, none);
  position: absolute;
  inset: calc(-1 * var(--stroke-width-thin));
  border-radius: inherit;
  pointer-events: none;
}
.glass {
  background: linear-gradient(var(--glass-on-lift, transparent) 0 0), var(--glass-on-fill, transparent);
  -webkit-backdrop-filter: var(--glass-on-blur, none);
  backdrop-filter: var(--glass-on-blur, none);
  box-shadow: var(--glass-on-shadow, none);
}
.edge {
  border: var(--stroke-width-thin) solid var(--glass-on-edge, transparent);
  mix-blend-mode: soft-light;
}
.content { position: relative; }
<div className={styles.card}>
  <span className={styles.glass} aria-hidden="true" />
  <span className={styles.edge} aria-hidden="true" />
  <div className={styles.content}>…</div>
</div>

A control with no blurred children carries its own blur:

.control {
  background: var(--glass-on-control-fill, var(--surface-subtle));
  box-shadow: inset 0 0 0 var(--stroke-width-thin) var(--glass-on-control-ring, var(--border-default));
  color: var(--glass-on-control-ink, var(--text-primary));
  -webkit-backdrop-filter: var(--glass-on-control-blur, none);
  backdrop-filter: var(--glass-on-control-blur, none);
}
.control:hover { background: var(--glass-on-control-hover-fill, var(--surface-muted)); }

Nested Blur

A backdrop-filter sees only as far back as its backdrop root. An ancestor with a backdrop-filter, a filter, an opacity below 1, a mask or a mix-blend-mode becomes that root, and a blurred field inside it then blurs only the card, not the photo. So:

  • Draw a surface's glass on a sibling layer (as above) or on its own ::before, never on the element that holds blurred children.
  • Keep every element between a blurred part and the photo free of filter, backdrop-filter, opacity below 1, mask and blend modes.
  • Fade glass parts one at a time, never their shared parent.
  • The edge's soft-light blend reaches the photo only while nothing between them forms a stacking context.

Lightning CSS

Write the -webkit-backdrop-filter line before backdrop-filter. Lightning CSS (Next.js) keeps only the last of the pair when the value holds a var(), so the unprefixed line must come last (VI-788).