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…
Small status indicators, labels, and counts, with optional ribbon, notch, flag, double-arrow and stamp shapes. Perfect for tags, statuses, and notification counts.
subtle (mode-aware tint) or outlined (transparent with a border) instead of filled.
data-shape
square, ribbon, notch, flag, double-arrow, stamp
—
square gives square corners instead of a pill. The other values are decorative shapes.
Colors
Semantic Colors
Use semantic colors for status indicators. They come from the --color-success, --color-warning, --color-error and --color-info tokens, so a theme can retune them. Keep the meaning in the badge text as well (see Accessibility).
Semantic colors - Status indicators (success/error), system messages, anything where color conveys meaning
Theme colors - Tags, labels, categories, decorative badges where color is for visual variety
Variants
Choose between solid (default), subtle, or outlined styles. Subtle badges pair a tinted background with the matching --color-*-text ink. Outlined badges use that ink for the text and border. Both switch between light and dark values with the colour scheme and keep at least 4.5:1 contrast.
data-shape also takes five decorative shapes for promotional labels, steps and stamps. They combine with every colour, variant and size. Shapes are drawn with clip-path: polygon() (the stamp's concave corners use shape() where supported and chamfered corners elsewhere), so they work in every current browser.
Concave bites out of every corner, like a ticket or stamp
How shapes behave
Labels are never clipped. The notch depth is a fixed length, --badge-notch (default 0.75em), and the padding on the notched side grows by the same amount, so a long label stops short of the notch.
Right-to-left. Shapes follow the inline direction: in dir="rtl" the ribbon's notch and the flag's point move to the left along with the padding.
Outlined cannot draw a border along a slanted edge, so an outlined shape is filled with a light wash of its text colour instead.
Themes. The shape is painted on a layer behind the text, so set --badge-shape-fill (it accepts gradients) and use filter: drop-shadow() rather than box-shadow, which would draw a rectangle. The cyber and kawaii themes restyle shaped badges this way.
Colour is never the only signal. A red badge reading “3” or a green dot means nothing to someone who cannot tell the colours apart. Put the meaning in the text (“Failed”, “Paid”, “Beta”), or add an icon with a text alternative.
Counts need context. A bare number next to “Messages” is read as “Messages 3”. Add visually hidden text so the count makes sense on its own: <layout-badge>3<span class="visually-hidden"> unread</span></layout-badge>.
A badge is static text. If its count changes while the page is open and the change matters, announce it through a live region (for example role="status" on a container) rather than relying on the badge alone.
Every colour and variant combination meets 4.5:1 text contrast in both light and dark mode with the default theme. If a theme overrides the status tokens, check its --color-*-text and -subtle pairs too.
Solid badges take their text colour from contrast-color(). Browsers without it get black or white text, whichever contrasts more with the badge background, worked out from the background itself. This holds in either mode and with any theme.
In forced-colors mode every badge gets a CanvasText border, because the system removes the background that would otherwise mark its edges. Shaped badges show the same rectangular border: the shape is decoration and its meaning must be in the text.
Shapes are painted on a layer behind the badge rather than clipping the badge itself, so when a badge sits inside a link or button the focus outline and the label stay whole. The shape fill is kept when printing.
A shape is not announced. “Sale” in a ribbon reads as “Sale”; do not rely on the shape (for example a flag pointing forward) to carry meaning.