Vanilla Breeze v0.7.4

Vanilla Breeze v0.7.4 released

0.7.4 gives the Ambient pack weather. A page names one feed URL on its own site, and the pack sets data-weather from it, uses its sunrise and sunset for dawn and dusk, and never shows a stale observation. Helpers for producing the feed from Open-Meteo are included. Ambient p…

Read the release notes

Shadows

How depth works in Vanilla Breeze: an elevation scale of shadow tokens, when to use box-shadow and when drop-shadow, and the opt-in data-shadow effects.

The elevation scale

Shadows are tokens. Six levels run from a hairline of depth to a floating panel, and every element that casts a shadow reads one of them. A <layout-card> uses --shadow-s, for example, and --shadow-m with data-variant="elevated".

TokenUse
--shadow-xs, --shadow-s, --shadow-m, --shadow-l, --shadow-xl, --shadow-2xlThe elevation scale, lowest to highest
--shadow-innerAn inset shadow for wells and pressed states
--shadow-flushA 1px edge plus a soft drop, as an alternative to a border on a raised surface. See Feel.
--shadow-noneAn explicit reset to no shadow

The lower three levels are one or two tight layers. From --shadow-l up, each token stacks several layers, a close one for contact and wider, softer ones for ambient light, so a raised surface does not look like one flat blur.

Themes and dark mode

A theme can replace the scale. Swiss removes shadows, and themes such as Brutalist and Neumorphism define their own style of shadow under the same token names. In dark mode the library replaces the whole scale, --shadow-xs to --shadow-2xl, and --shadow-inner with stronger values, because a faint shadow does not show on a dark page. --shadow-flush changes its 1px edge from dark to light for the same reason.

To change the scale yourself, set the tokens on :root or on one region:

box-shadow or drop-shadow

The two look alike and paint differently. Using the wrong one is why a shadow on a clipped badge or a transparent logo comes out as a rectangle.

box-shadowfilter: drop-shadow()
PaintsThe element's box: a rectangle, rounded by border-radiusThe element's visible pixels, so it follows the real shape
Use forCards, panels, popovers, raised surfacesClipped shapes, transparent PNG and SVG images, text
Combines withOther box shadows, separated by commasOther filter functions
In the libraryThe --shadow-* tokens, data-shadow="tint", material and glowdata-shadow="shape"

A transparent PNG, an SVG or a run of text has its own shape, so drop-shadow goes directly on it. Only clip-path needs the wrapper. The same applies to the shape attributes, which clip.

The data-shadow effects

data-shadow adds a shadow effect to any element. It needs no script. The effects read the theme's tokens, so they change color with the theme, and they sit in the bundle-effects layer, so they replace an element's own shadow.

ValueEffect
tintA colored shadow mixed from --color-accent
materialRests at --shadow-m. On hover or keyboard focus it rises to --shadow-xl and moves up 4px.
shapeA drop-shadow that follows the element's visible shape. On a clipped element, put it on a wrapper.
glowA soft halo in the accent color. Add flicker for a slow pulse.

The value is a space-separated list, which is how flicker joins glow. tint, material and glow each set box-shadow, so use one of those three at a time. shape uses filter and can be added to any of them.

Adjusting the glow

The glow reads two custom properties that it sets on the element. Override them in a rule of your own on the same element.

Reduced motion

When the system asks for reduced motion, material still changes its shadow on hover but does not move or animate, and flicker does not run, which leaves the still glow. The data-motion-reduced switch described in Preferences does the same.

On busy backgrounds

tint and glow are about half transparent, so their color survives over a photograph or a texture. If you write a colored shadow of your own, keep it at least that transparent, or the color turns muddy.

↑