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

Borders and Shape

Border widths, the radius scale that rounds every corner in Vanilla Breeze, and the opt-in attributes that clip images, sections and badges into other shapes.

Borders

Three width tokens and three color tokens draw every line in the library. Use them together so a border of your own matches the ones around it and follows the theme and the mode.

Token Default Used for
--border-width-thin1pxDividers, table rows, outlined cards
--border-width-medium2pxTable header rules, the link focus outline
--border-width-thick4pxThe accent edge of a status message
--color-borderLight gray, or dark gray in dark modeThe default line
--color-border-strongOne step darkerA line that needs to stand out
--color-border-subtleOne step lighterA faint separator

These border colors are decorative and are not meant to meet a contrast ratio. Form controls draw their edge with --control-border, which is darker so that the control can be found. For an edge that reads as a faint line plus a little lift, see --shadow-flush in Shadows.

The radius scale

Every rounded corner reads one of these tokens. Change the tokens and buttons, cards, inputs, badges and dialogs change together.

Token Default Used by
--radius-xs0.125rem (2px)Fine details such as markers
--radius-s0.25rem (4px)Checkboxes
--radius-m0.5rem (8px)Buttons, text inputs, img.rounded
--radius-l0.75rem (12px)<layout-card>, <dialog>
--radius-xl1rem (16px)Yours to use for larger panels
--radius-2xl1.5rem (24px)Yours to use for the largest surfaces
--radius-full9999pxPills and circles: radio buttons, img.circle

Changing the corners

Set the tokens on :root for the whole page, or on any element for one region.

A theme does the same thing. Swiss sets every radius to zero, Classic makes them small, and Kawaii and Claymorphism make them large. If you want a theme's corners along with its colors and type, pick the theme.

One case needs care in a region. Text inputs take their radius from --input-radius, which is computed from --radius-m on :root. Inside a region, set --input-radius as well as --radius-m.

Corners inside corners

A rounded box inside a rounded box looks right when the inner radius is the outer radius minus the padding between them. --radius-inner holds that value. Set the parent's radius in --_radius and its padding in --_inset, and use --radius-inner on anything inside it.

The last panel in the demo above is built this way. The result stops at zero when the padding is larger than the radius. Without --_radius the token starts from --radius-m, and without --_inset it subtracts nothing. The two properties inherit, so a box nested a level further down should set its own pair.

Other shapes

A set of attributes clips an element to a shape that a radius cannot make. Each is opt-in and needs no script.

Attribute Goes on What it does
data-clip <img> or <figure> Clips the image to hexagon, arch, leaf, swoosh, diagonal-frame or torn
data-border-shape A wrapper around an image Draws a colored hexagon, diamond or arch frame around it
data-shape-start, data-shape-end A <section>, <article>, <header>, <footer> or <aside> Cuts the top or bottom edge into a wave, chevron, scallop or diagonal
data-cutout Any element Punches a hole through it, or bites a corner
data-shape <layout-badge> Ribbon, notch, flag, double arrow and stamp badges
data-bubble, data-callout A message or a note Chat bubbles with tails, and callout boxes
data-morph A clipped element Animates between matching shapes. It stops under reduced motion.

What to expect

  • The shapes are drawn with the CSS shape() function. Each rule sits inside an @supports test, so a browser without shape() shows the element unclipped and fully usable.
  • Image clips are sized in percentages of the image, so they scale with it.
  • Shapes with a direction, such as swoosh and diagonal, mirror in right-to-left text.
  • Section edges are dropped in forced colors and in print, where they would only cut content.
  • A clipped element clips its own box-shadow. To put a shadow on a shape, see Shadows.
↑