Skip to content

Theme and tokens ​

All of Beedesign's styling goes through CSS variables prefixed with --bd-. Redefine them in your project's global CSS, after importing @thaisrr/beedesign/style.css:

css
:root {
  --bd-color-primary: #0f766e;
  --bd-color-primary-hover: #0d645d;
  --bd-color-primary-edge: #094a45;
  --bd-color-on-primary: #ffffff;
  --bd-font-title: "Libre Bodoni", serif;
}

BeePalette ​

BeePalette is a website that enable you to create a theme for BeeDesign, easily : https://thaisrr.github.io/bee-palette/

Dark mode ​

Add the dark class or the data-theme="dark" attribute on <html> (or on any parent). The color tokens flip, and the violet and amber are lightened to stay readable.

If you change --bd-color-primary, also redefine its dark version:

css
.dark,
[data-theme="dark"] {
  --bd-color-primary: #5eead4;
  --bd-color-on-primary: #042f2e;
}

Colors ​

TokenRole
--bd-color-primaryBrand color.
--bd-color-primary-hoverHover state of the primary button.
--bd-color-primary-edgeBottom edge of the primary button.
--bd-color-on-primaryText placed on the brand color.
--bd-color-primary-darkInk: strong text and outlines.
--bd-color-primary-lightLight backgrounds, hover states.
--bd-color-accentAccent color.
--bd-color-on-accentText placed on the accent.
--bd-color-bgPage background.
--bd-color-surfaceCards and panels.
--bd-color-textBody text.
--bd-color-text-mutedSecondary text.
--bd-color-borderSubtle borders.
--bd-color-border-strongField borders and strong separators.
--bd-color-focusFocus ring.

Sizes, borders and focus ​

These variables are in pixels. Only font sizes use rem, so that they follow the browser's text size setting.

TokenDefaultRole
--bd-space-sm8 pxSmall spacing.
--bd-space-md16 pxMedium spacing.
--bd-space-lg32 pxLarge spacing.
--bd-control-height44 pxMinimum height of a control (the button).
--bd-close-size36 pxSize of the close buttons (modal, drawer).
--bd-overlay-width448 pxDefault width of the modal and the drawer.
--bd-border-width1 pxBorder of cards, tags, alerts, modal and drawer.
--bd-border-width-strong2 pxBorder of buttons.
--bd-alert-stripe-width4 pxColored stripe on the left of an alert.
--bd-focus-ring-width3 pxThickness of the focus ring.
--bd-focus-ring-offset2 pxGap between the element and its focus ring.
--bd-button-edge3 pxHeight of the edge under the primary button.
css
:root {
  --bd-control-height: 48px;
  --bd-focus-ring-width: 4px;
}

Accessibility

Reducing these values can make the interface harder to use. WCAG 2.2 asks for targets of at least 24 px (criterion 2.5.8) and a visible focus indicator (2.4.7). Beedesign aims for 44 px on buttons. Below 44 px for --bd-control-height, or below 2 px for --bd-focus-ring-width, test the interface with a keyboard and on a touch screen.

The full list is in src/styles/tokens.css.