Skip to content

CSS Tokens

The Markdown editor environment exposes CSS variables (tokens) that map to the active theme (including Light and Dark modes). Using these tokens instead of hard-coded values ensures your content remains visually consistent and accessible across all modes.

Tokens can be used within a <style> block or directly in inline style attributes.

Colors

The color system uses standard roles (Primary, Secondary, Tertiary, Error, etc.). For each role, there is a base color, an "on-" color (for text/icons placed on top of the base color), and container variants.

Primary, Secondary, & Tertiary

TokenDescription
--color-primaryThe main brand color.
--color-on-primaryColor for text/icons on a primary background.
--color-primary-containerA lighter/softer variant of the primary color for containers.
--color-on-primary-containerColor for text/icons on a primary container.
--color-secondaryThe secondary brand color.
--color-on-secondaryColor for text/icons on a secondary background.
--color-secondary-containerA lighter/softer variant of the secondary color.
--color-on-secondary-containerColor for text/icons on a secondary container.
--color-tertiaryThe tertiary brand color.
--color-on-tertiaryColor for text/icons on a tertiary background.
--color-tertiary-containerA lighter/softer variant of the tertiary color.
--color-on-tertiary-containerColor for text/icons on a tertiary container.

Status Colors

TokenDescription
--color-successColor indicating a successful action.
--color-on-successColor for text/icons on a success background.
--color-success-containerA lighter/softer variant of the success color.
--color-on-success-containerColor for text/icons on a success container.
--color-warningColor indicating a warning or non-critical issue.
--color-on-warningColor for text/icons on a warning background.
--color-warning-containerA lighter/softer variant of the warning color.
--color-on-warning-containerColor for text/icons on a warning container.
--color-errorColor indicating a critical error or destructive action.
--color-on-errorColor for text/icons on an error background.
--color-error-containerA lighter/softer variant of the error color.
--color-on-error-containerColor for text/icons on an error container.

Neutral & Surface Colors

TokenDescription
--color-backgroundThe underlying background color of the page.
--color-on-backgroundColor for text/icons on the background.
--color-surfaceBackground color for components like cards, sheets, and menus.
--color-on-surfaceColor for text/icons on a surface background.
--color-surface-variantA subtle variant of the surface color.
--color-on-surface-variantColor for text/icons on a surface variant.
--color-surface-containerBackground color for grouping related surface elements.
--color-on-surface-containerColor for text/icons on a surface container.
--color-outlineColor used for borders, dividers, and outlines.

Spacing

Use spacing tokens for margin, padding, and gap properties to ensure consistent rhythmic spacing.

TokenValue
--space-xxx-small2px
--space-xx-small4px
--space-x-small8px
--space-small12px
--space-medium16px
--space-large20px
--space-x-large28px
--space-xx-large36px
--space-xxx-large48px

Typography

Use typography tokens to maintain consistent font sizes and weights.

Font Size

TokenValue
--font-size-x-small0.75rem
--font-size-small0.875rem
--font-size-medium1rem
--font-size-large1.25rem
--font-size-x-large1.5rem
--font-size-xx-large2.25rem
--font-size-xxx-large3rem

Font Weight

TokenValue
--font-weight-thin200
--font-weight-normal400
--font-weight-semi-bold500
--font-weight-bold700
--font-weight-extra-bold800

Example Usage

html
<div style="background-color: var(--color-primary-container); color: var(--color-on-primary-container); padding: var(--space-medium); border-radius: var(--space-x-small);">
  <p style="font-size: var(--font-size-large); font-weight: var(--font-weight-bold); margin: 0 0 var(--space-small) 0;">
    Important Notice
  </p>
  <p style="margin: 0;">
    This box automatically adapts to dark and light mode themes.
  </p>
</div>