Dragonglass

Amber theme

Preview the Amber theme in light mode across semantic colors, components, and interactive states.

Browse light themes

Browse dark themes

Background and text colors

Each semantic color includes lightest, lighter, light, base, dark, darker and darkest tokens. White and black remain the global contrast extremes.

Primary background

Primary dark text

<div class="bg-primary p-3">Primary background</div>
<p class="text-primary-dark">Primary dark text</p>
bg-primary-lightest
bg-primary-lighter
bg-primary-light
bg-primary
bg-primary-dark
bg-primary-darker
bg-primary-darkest
text-primary-lightest
text-primary-lighter
text-primary-light
text-primary
text-primary-dark
text-primary-darker
text-primary-darkest
bg-accent-lightest
bg-accent-lighter
bg-accent-light
bg-accent
bg-accent-dark
bg-accent-darker
bg-accent-darkest
text-accent-lightest
text-accent-lighter
text-accent-light
text-accent
text-accent-dark
text-accent-darker
text-accent-darkest
bg-info-lightest
bg-info-lighter
bg-info-light
bg-info
bg-info-dark
bg-info-darker
bg-info-darkest
text-info-lightest
text-info-lighter
text-info-light
text-info
text-info-dark
text-info-darker
text-info-darkest
bg-success-lightest
bg-success-lighter
bg-success-light
bg-success
bg-success-dark
bg-success-darker
bg-success-darkest
text-success-lightest
text-success-lighter
text-success-light
text-success
text-success-dark
text-success-darker
text-success-darkest
bg-warning-lightest
bg-warning-lighter
bg-warning-light
bg-warning
bg-warning-dark
bg-warning-darker
bg-warning-darkest
text-warning-lightest
text-warning-lighter
text-warning-light
text-warning
text-warning-dark
text-warning-darker
text-warning-darkest
bg-danger-lightest
bg-danger-lighter
bg-danger-light
bg-danger
bg-danger-dark
bg-danger-darker
bg-danger-darkest
text-danger-lightest
text-danger-lighter
text-danger-light
text-danger
text-danger-dark
text-danger-darker
text-danger-darkest
bg-default-lightest
bg-default-lighter
bg-default-light
bg-default
bg-default-dark
bg-default-darker
bg-default-darkest
text-default-lightest
text-default-lighter
text-default-light
text-default
text-default-dark
text-default-darker
text-default-darkest

Transparent backgrounds

These utilities change only the background color and preserve the current text color.

Transparent background
Scrim background
Media scrim background
<div class="bg-transparent p-3">Transparent background</div>
<div class="bg-scrim text-white p-3">Scrim background</div>
<div class="bg-media-scrim text-white p-3">Media scrim background</div>

Buttons by color

<button type="button" class="bg-primary">primary</button>
<button type="button" class="bg-accent">accent</button>
<button type="button" class="bg-info">info</button>
<button type="button" class="bg-success">success</button>
<button type="button" class="bg-warning">warning</button>
<button type="button" class="bg-danger">danger</button>
<button type="button" class="bg-default">default</button>

Form fields by color

Uses the primary theme color.
Uses the accent theme color.
Uses the info theme color.
Uses the success theme color.
Uses the warning theme color.
Uses the danger theme color.
Uses the default theme color.
<fieldset data-field="primary">
  <label for="primary-field">primary field</label>
  <input id="primary-field" name="primary-field" type="text" aria-describedby="primary-field-help">
  <small id="primary-field-help">Uses the primary theme color.</small>
</fieldset>
<fieldset data-field="accent">
  <label for="accent-field">accent field</label>
  <input id="accent-field" name="accent-field" type="text" aria-describedby="accent-field-help">
  <small id="accent-field-help">Uses the accent theme color.</small>
</fieldset>
<fieldset data-field="info">
  <label for="info-field">info field</label>
  <input id="info-field" name="info-field" type="text" aria-describedby="info-field-help">
  <small id="info-field-help">Uses the info theme color.</small>
</fieldset>
<fieldset data-field="success">
  <label for="success-field">success field</label>
  <input id="success-field" name="success-field" type="text" aria-describedby="success-field-help">
  <small id="success-field-help">Uses the success theme color.</small>
</fieldset>
<fieldset data-field="warning">
  <label for="warning-field">warning field</label>
  <input id="warning-field" name="warning-field" type="text" aria-describedby="warning-field-help">
  <small id="warning-field-help">Uses the warning theme color.</small>
</fieldset>
<fieldset data-field="danger">
  <label for="danger-field">danger field</label>
  <input id="danger-field" name="danger-field" type="text" aria-describedby="danger-field-help">
  <small id="danger-field-help">Uses the danger theme color.</small>
</fieldset>
<fieldset data-field="default">
  <label for="default-field">default field</label>
  <input id="default-field" name="default-field" type="text" aria-describedby="default-field-help">
  <small id="default-field-help">Uses the default theme color.</small>
</fieldset>

Interactive color states

<button type="button" class="bg-primary-dark hover:bg-primary active:bg-primary-light">Background states</button>
<input aria-label="Color focus example" class="p-3 text-primary-dark focus:text-primary" value="Focus this field">

Compile a theme from one color

The Sass theme module derives every semantic family, weight, foreground and progress color from one opaque primary. Every base uses its lightest family token as foreground. The compiler accepts an OKLCH primary lightness from 42% through 56% and a contrast ratio of at least 4.5:1 for that pair. The compiled theme loads after dragonglass.css.

@use "pkg:dragonglass/theme" as dragonglass;

:root {
  @include dragonglass.tokens(#7c3aed);
}
bunx sass --pkg-importer=node theme.scss theme.css --style=compressed

A theme selector around each mixin call lets one stylesheet contain several themes.

@use "pkg:dragonglass/theme" as dragonglass;

[data-theme="violet"] {
  @include dragonglass.tokens(#7c3aed);
}

[data-theme="forest"] {
  @include dragonglass.tokens(#167c55);
}

Automatic dark mode

Each theme derives dark structural roles from the same primary and follows prefers-color-scheme automatically. The data-color-scheme attribute on the root element forces light or dark mode.

<html data-color-scheme="dark"></html>

Color tokens

Semantic custom properties expose token values directly as an alternative to generated color utility classes.

Primary token preview
<div style="background-color: var(--primary); color: var(--primary-darker)">
  Primary token preview
</div>
Semantic color custom properties
NameTypeDefaultDescription
--primary-lightestCSS color tokenprimaryUsed by bg-primary-lightest, text-primary-lightest, border-primary-lightest and outline-primary-lightest.
--primary-lighterCSS color tokenprimaryUsed by bg-primary-lighter, text-primary-lighter, border-primary-lighter and outline-primary-lighter.
--primary-lightCSS color tokenprimaryUsed by bg-primary-light, text-primary-light, border-primary-light and outline-primary-light.
--primaryCSS color tokenprimaryUsed by bg-primary, text-primary, border-primary and outline-primary.
--primary-darkCSS color tokenprimaryUsed by bg-primary-dark, text-primary-dark, border-primary-dark and outline-primary-dark.
--primary-darkerCSS color tokenprimaryUsed by bg-primary-darker, text-primary-darker, border-primary-darker and outline-primary-darker.
--primary-darkestCSS color tokenprimaryUsed by bg-primary-darkest, text-primary-darkest, border-primary-darkest and outline-primary-darkest.
--accent-lightestCSS color tokenaccentUsed by bg-accent-lightest, text-accent-lightest, border-accent-lightest and outline-accent-lightest.
--accent-lighterCSS color tokenaccentUsed by bg-accent-lighter, text-accent-lighter, border-accent-lighter and outline-accent-lighter.
--accent-lightCSS color tokenaccentUsed by bg-accent-light, text-accent-light, border-accent-light and outline-accent-light.
--accentCSS color tokenaccentUsed by bg-accent, text-accent, border-accent and outline-accent.
--accent-darkCSS color tokenaccentUsed by bg-accent-dark, text-accent-dark, border-accent-dark and outline-accent-dark.
--accent-darkerCSS color tokenaccentUsed by bg-accent-darker, text-accent-darker, border-accent-darker and outline-accent-darker.
--accent-darkestCSS color tokenaccentUsed by bg-accent-darkest, text-accent-darkest, border-accent-darkest and outline-accent-darkest.
--info-lightestCSS color tokeninfoUsed by bg-info-lightest, text-info-lightest, border-info-lightest and outline-info-lightest.
--info-lighterCSS color tokeninfoUsed by bg-info-lighter, text-info-lighter, border-info-lighter and outline-info-lighter.
--info-lightCSS color tokeninfoUsed by bg-info-light, text-info-light, border-info-light and outline-info-light.
--infoCSS color tokeninfoUsed by bg-info, text-info, border-info and outline-info.
--info-darkCSS color tokeninfoUsed by bg-info-dark, text-info-dark, border-info-dark and outline-info-dark.
--info-darkerCSS color tokeninfoUsed by bg-info-darker, text-info-darker, border-info-darker and outline-info-darker.
--info-darkestCSS color tokeninfoUsed by bg-info-darkest, text-info-darkest, border-info-darkest and outline-info-darkest.
--success-lightestCSS color tokensuccessUsed by bg-success-lightest, text-success-lightest, border-success-lightest and outline-success-lightest.
--success-lighterCSS color tokensuccessUsed by bg-success-lighter, text-success-lighter, border-success-lighter and outline-success-lighter.
--success-lightCSS color tokensuccessUsed by bg-success-light, text-success-light, border-success-light and outline-success-light.
--successCSS color tokensuccessUsed by bg-success, text-success, border-success and outline-success.
--success-darkCSS color tokensuccessUsed by bg-success-dark, text-success-dark, border-success-dark and outline-success-dark.
--success-darkerCSS color tokensuccessUsed by bg-success-darker, text-success-darker, border-success-darker and outline-success-darker.
--success-darkestCSS color tokensuccessUsed by bg-success-darkest, text-success-darkest, border-success-darkest and outline-success-darkest.
--warning-lightestCSS color tokenwarningUsed by bg-warning-lightest, text-warning-lightest, border-warning-lightest and outline-warning-lightest.
--warning-lighterCSS color tokenwarningUsed by bg-warning-lighter, text-warning-lighter, border-warning-lighter and outline-warning-lighter.
--warning-lightCSS color tokenwarningUsed by bg-warning-light, text-warning-light, border-warning-light and outline-warning-light.
--warningCSS color tokenwarningUsed by bg-warning, text-warning, border-warning and outline-warning.
--warning-darkCSS color tokenwarningUsed by bg-warning-dark, text-warning-dark, border-warning-dark and outline-warning-dark.
--warning-darkerCSS color tokenwarningUsed by bg-warning-darker, text-warning-darker, border-warning-darker and outline-warning-darker.
--warning-darkestCSS color tokenwarningUsed by bg-warning-darkest, text-warning-darkest, border-warning-darkest and outline-warning-darkest.
--danger-lightestCSS color tokendangerUsed by bg-danger-lightest, text-danger-lightest, border-danger-lightest and outline-danger-lightest.
--danger-lighterCSS color tokendangerUsed by bg-danger-lighter, text-danger-lighter, border-danger-lighter and outline-danger-lighter.
--danger-lightCSS color tokendangerUsed by bg-danger-light, text-danger-light, border-danger-light and outline-danger-light.
--dangerCSS color tokendangerUsed by bg-danger, text-danger, border-danger and outline-danger.
--danger-darkCSS color tokendangerUsed by bg-danger-dark, text-danger-dark, border-danger-dark and outline-danger-dark.
--danger-darkerCSS color tokendangerUsed by bg-danger-darker, text-danger-darker, border-danger-darker and outline-danger-darker.
--danger-darkestCSS color tokendangerUsed by bg-danger-darkest, text-danger-darkest, border-danger-darkest and outline-danger-darkest.
--default-lightestCSS color tokendefaultUsed by bg-default-lightest, text-default-lightest, border-default-lightest and outline-default-lightest.
--default-lighterCSS color tokendefaultUsed by bg-default-lighter, text-default-lighter, border-default-lighter and outline-default-lighter.
--default-lightCSS color tokendefaultUsed by bg-default-light, text-default-light, border-default-light and outline-default-light.
--defaultCSS color tokendefaultUsed by bg-default, text-default, border-default and outline-default.
--default-darkCSS color tokendefaultUsed by bg-default-dark, text-default-dark, border-default-dark and outline-default-dark.
--default-darkerCSS color tokendefaultUsed by bg-default-darker, text-default-darker, border-default-darker and outline-default-darker.
--default-darkestCSS color tokendefaultUsed by bg-default-darkest, text-default-darkest, border-default-darkest and outline-default-darkest.