All components must consume the shared design tokens defined by x-theme (src/baredom/components/x_theme/model.cljs). In :host CSS custom property declarations, wrap hardcoded values with var(--x-token, fallback) so the original value is preserved when no <x-theme> is present:
/* Correct — themed with fallback */
--x-foo-bg: var(--x-color-surface, #ffffff);
/* Wrong — ignores theme tokens */
--x-foo-bg: #ffffff;
TOKEN-COVERAGE.md shows, for each component, how many values of each token family follow the theme. It is generated: run bb scripts/audit_tokens.bb doc after a change to a component's CSS. CI fails when it is out of date. A value that follows no token on purpose is listed with its reason in scripts/tokens_by_design.edn.
--x-color-primary, --x-color-primary-hover, --x-color-primary-active--x-color-secondary, --x-color-secondary-hover, --x-color-secondary-active--x-color-tertiary, --x-color-tertiary-hover, --x-color-tertiary-active--x-color-surface, --x-color-surface-hover, --x-color-surface-active--x-color-bg--x-color-text, --x-color-text-muted--x-color-border--x-color-focus-ring--x-color-danger, --x-color-success, --x-color-warning, each with -hover and -active--x-font-family, --x-font-family-mono--x-font-size-xs, --x-font-size-sm, --x-font-size-base, --x-font-size-lg--x-font-weight-normal, --x-font-weight-medium, --x-font-weight-semibold, --x-font-weight-bold--x-line-height-normal--x-space-xs, --x-space-sm, --x-space-md, --x-space-lg, --x-space-xl--x-radius-sm, --x-radius-md, --x-radius-lg, --x-radius-xl, --x-radius-full--x-border-width--x-shadow-sm, --x-shadow-md, --x-shadow-lg--x-z-dropdown (1000)--x-z-modal (1100)--x-z-toast (9000)--x-opacity-disabled — for disabled states--x-opacity-placeholder — for placeholder/muted content--x-transition-duration--x-transition-easing--x-color-bg (always opaque), never --x-color-surface (can be semi-transparent in Aurora theme)--x-color-surface--x-color-surface-hover for hover and --x-color-surface-active for press or for a subtle fill. On a panel painted with --x-color-bg, use --x-color-surface-active for hover, because the hover surface equals the background in some presets.color-mix(in srgb,var(--x-color-text,#000) 6%,transparent), with #fff as the fallback in the dark block.color-mix(in srgb,var(--x-color-danger,rgb(190,20,40)) 10%,transparent), with the present colour as the fallback.var(--x-border-width,1px) for the width. A size computed from that border, such as the offset of an arrow, uses it too.--x-z-dropdown.--x-z-modal for its backdrop and one above for its panel.--x-z-toast.<script src="demo-theme.js" defer></script> in every demo pagevar(--page-bg), var(--surface-bg), var(--input-bg) etc. from demo-responsive.css — never hardcode colours:root variables, add an x-theme { ... } block that re-maps them to theme tokens (:root resolves before <x-theme> in the DOM tree)Can you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |