Skip to content
The design kit

Tokens and theme

Tokens are the named colors, sizes and waits that every piece of the design kit is drawn from. Your own styles can use them too and match the kit.

Every name starts with --dk-, so it never clashes with your page’s own names. Use one as you would any custom property, such as padding: var(--dk-space-4). The properties the kit leaves for a page to set, such as --dk-focus, and the layer a page puts its own rules in are on A page’s own palette.

Color

Each color has a role, such as text or the page itself, and a value in each theme, both shown whatever theme you are in. Choose by role, so text is --dk-fg and a card is --dk-surface, and it stays right in both themes. To change a role in every piece at once, set it again on your page’s root as one light-dark() that holds both themes, as A page’s own palette does.

What the tests check for Color

These are the design kit’s own tests for this part, by the file each is in. They come from the source on GitHub as it was when this page was built, so they can be newer than the version named in the footer. Each file name opens that file as it was then.

Back to contents

Contrast

Contrast is how far apart two colors are in brightness, written as a ratio. WCAG, the web’s accessibility guidelines, asks for 4.5 to 1 between text and its background and 3 to 1 for the edge of a control. Every pairing here meets that in both themes, so pair colors as they are paired here. In each theme’s grid the drawn color runs across the top and the ground it sits on down the side, in one order for both themes with the least to spare first, and a dash marks a pairing the kit never makes. The page shows both themes’ grids whatever theme you are in. The figures come from this version’s tokens and are rounded down, and the kit’s tests check each one before a release.

Contrast in the light theme, each ratio to 1, the least to spare first

Ground--dk-control--dk-success--dk-muted--dk-accent--dk-danger--dk-warning--dk-on-accent--dk-fg
Needs3.004.504.504.504.504.504.504.50
--dk-highlight3.06Not a pairing5.545.50Not a pairingNot a pairingNot a pairing14.44
--dk-success-bg3.284.785.955.90Not a pairingNot a pairingNot a pairing15.50
--dk-danger-bg3.21Not a pairing5.825.775.69Not a pairingNot a pairing15.16
--dk-warning-bg3.35Not a pairing6.076.02Not a pairing5.74Not a pairing15.80
--dk-surface3.384.936.136.075.995.80Not a pairing15.96
--dk-raised3.695.376.686.626.536.32Not a pairing17.40
--dk-bg3.695.376.686.626.536.32Not a pairing17.40
--dk-accentNot a pairingNot a pairingNot a pairingNot a pairingNot a pairingNot a pairing6.62Not a pairing

Contrast in the dark theme, each ratio to 1, the least to spare first

Ground--dk-control--dk-success--dk-muted--dk-accent--dk-danger--dk-warning--dk-on-accent--dk-fg
Needs3.004.504.504.504.504.504.504.50
--dk-highlight3.11Not a pairing5.205.99Not a pairingNot a pairingNot a pairing11.24
--dk-success-bg3.456.465.786.66Not a pairingNot a pairingNot a pairing12.49
--dk-danger-bg3.66Not a pairing6.117.046.60Not a pairingNot a pairing13.22
--dk-warning-bg3.28Not a pairing5.486.31Not a pairing7.30Not a pairing11.85
--dk-surface4.047.576.767.797.309.01Not a pairing14.62
--dk-raised3.486.515.826.716.287.76Not a pairing12.59
--dk-bg4.558.507.608.768.2010.13Not a pairing16.43
--dk-accentNot a pairingNot a pairingNot a pairingNot a pairingNot a pairingNot a pairing8.76Not a pairing
What the tests check for Contrast

These are the design kit’s own tests for this part, by the file each is in. They come from the source on GitHub as it was when this page was built, so they can be newer than the version named in the footer. Each file name opens that file as it was then.

Back to contents

Sizes, type and motion

This section holds every size, type step and wait, then the shadows, the stack order, the scrim and the grounds. Sizes that should grow with the reader’s text size are in rem. Code inside a sentence is in em, so it matches the words around it. Borders, the focus ring and shadows are in px, since they stay the same size.

Spacing

Steps 1 to 3 space the parts inside a piece, such as a label and its field or the buttons in a row. Steps 4 to 6 pad a piece and set pieces apart, such as the inside of a card or the room above a page’s title. Steps 6 to 8 set a page’s own sections apart, step 6 on an explainer and step 7 on a content page, a band or a group of sections.

Type

--dk-text-numeral is for a score read from across a table.

Line heights, weights, tracking and faces

TokenValue
--dk-leading-tight1.2
--dk-leading-body1.5
--dk-weight-normal400
--dk-weight-medium500
--dk-weight-strong600
--dk-tracking-caps0.06em
--dk-font-sanssystem-ui, -apple-system, 'Segoe UI', Roboto, sans-serif
--dk-font-monoui-monospace, 'SF Mono', Menlo, Consolas, monospace

Radius

The pill radius is set far larger than any tab or tag is tall, so their ends are always fully round.

Every radius

TokenValue
--dk-radius-small0.25rem
--dk-radius0.375rem
--dk-radius-large0.5rem
--dk-radius-pill999px

Motion and waits

The durations set how long the kit’s motion takes, such as a hover or a sheet arriving, and a reader who turns on reduced motion gets none. --dk-wait is a delay, not a motion. The kit waits that long before it shows something is busy, such as a busy button turning gray or a loading line appearing, so a fast answer shows nothing. Reduced motion and forced colors both keep it.

Every duration and wait

TokenValue
--dk-duration-short150ms
--dk-duration-medium250ms
--dk-wait400ms

Sizes

They include the height of a field, the least size of anything a thumb presses, and the width of the page’s column and of a line of reading. The sizes worked out from other tokens or from the screen, such as the insets that keep a page clear of a phone’s edges, are folded under the table.

Every other size

TokenValue
--dk-ring-width2px
--dk-ring-offset2px
--dk-indicator-width2px
--dk-field-height2.25rem
--dk-field-inline0.75rem
--dk-target2.75rem
--dk-target-large3.5rem
--dk-strip2.5rem
--dk-strip-toolsauto
--dk-measure34rem
--dk-column72rem
--dk-app-column28rem
--dk-app-bar4rem
--dk-app-body8rem
--dk-dialog-width32rem
--dk-icon-size1.25rem or 1.5rem
Sizes worked out from other tokens or the screen

Every size worked out from other tokens or the screen

TokenValue
--dk-space-4-heldmin(var(--dk-space-4), 16px)
--dk-space-5-heldmin(var(--dk-space-5), 24px)
--dk-field-inline-heldmin(var(--dk-field-inline), 12px)
--dk-app-sidevar(--dk-space-4-held)
--dk-safe-topenv(safe-area-inset-top, 0px)
--dk-safe-rightenv(safe-area-inset-right, 0px)
--dk-safe-bottomenv(safe-area-inset-bottom, 0px)
--dk-safe-leftenv(safe-area-inset-left, 0px)
--dk-column-insetmax(0px, (100% - var(--dk-column)) / 2)
--dk-app-insetmax(0px, (100vw - var(--dk-app-column)) / 2)
--dk-band-leftcalc(max(var(--dk-safe-left), var(--dk-column-inset)) + var(--dk-space-4))
--dk-band-rightcalc(max(var(--dk-safe-right), var(--dk-column-inset)) + var(--dk-space-4))
--dk-card-insetvar(--dk-space-5)
--dk-dialog-insetvar(--dk-space-5-held)
--dk-flow-stepvar(--dk-space-4) or var(--dk-space-3) or var(--dk-space-2)

Shadows, stacking and grounds

Shadows lift a piece off the page. The stack order sets what sits over what, the bars under the toast and the skip link over everything. A ground is the background a container such as a panel or a dialog sets for what it holds. The layer a page puts its own rules in, and the properties it sets, are on A page’s own palette.

Every shadow, stack and ground

TokenValue
--dk-shadow-raised0 6px 24px light-dark(rgb(0 0 0 / 0.18), rgb(0 0 0 / 0.5))
--dk-shadow-resting0 1px 3px light-dark(rgb(0 0 0 / 0.12), rgb(0 0 0 / 0.4))
--dk-scrimlight-dark(rgb(0 0 0 / 0.4), rgb(0 0 0 / 0.6))
--dk-stack-pinned1
--dk-stack-raised2
--dk-stack-bar3
--dk-stack-toast4
--dk-stack-skip10
--dk-groundvar(--dk-raised) or var(--dk-surface)
--dk-ground-stepvar(--dk-surface) or var(--dk-bg)
What the tests check for Sizes, type and motion

These are the design kit’s own tests for this part, by the file each is in. They come from the source on GitHub as it was when this page was built, so they can be newer than the version named in the footer. Each file name opens that file as it was then.

Back to contents

How the theme is chosen

The kit’s theme script runs before anything is drawn, so a page never flashes the wrong theme. With scripts on, you choose Light, Dark or System next to Theme, at the top of the page. Your choice is saved, reaches your other tabs and is shared with the portfolio and every demo on jasonsdevspace.com, this site included. System, or no saved choice, follows your system’s setting. With scripts off, the page follows your system’s setting and does not use a saved choice.

What the tests check for How the theme is chosen

These are the design kit’s own tests for this part, by the file each is in. They come from the source on GitHub as it was when this page was built, so they can be newer than the version named in the footer. Each file name opens that file as it was then.

Back to contents