Skip to main content

Theming

All Skillspilot web components use the --dwc-* CSS custom property system from the DWC (Dynamic Web Components) design system. This ensures visual consistency when components are used alongside other DWC-based applications.

DWC Token System

CSS custom properties (tokens) follow a consistent naming convention:

--dwc-<category>-<variant>-<modifier>

For example:

  • --dwc-color-primary — primary brand color
  • --dwc-color-primary-text — text color on primary background
  • --dwc-border-radius — default corner radius
  • --dwc-font-size-m — medium font size

Components work with sensible defaults when no external DWC theme is loaded — you do not need to configure anything to see functional components.

Available Token Categories

Colors

TokenDescriptionExample
--dwc-color-primaryPrimary brand colorBlue, used for interactive elements
--dwc-color-successSuccess state colorGreen
--dwc-color-warningWarning state colorOrange/yellow
--dwc-color-dangerError/danger state colorRed
--dwc-color-defaultNeutral/default colorGray

Spacing

TokenDescription
--dwc-space-xsExtra small spacing (4px)
--dwc-space-sSmall spacing (8px)
--dwc-space-mMedium spacing (16px)
--dwc-space-lLarge spacing (24px)
--dwc-space-xlExtra large spacing (32px)

Typography

TokenDescription
--dwc-font-familyBase font family
--dwc-font-size-sSmall font size
--dwc-font-size-mMedium font size
--dwc-font-size-lLarge font size

Borders and Shadows

TokenDescription
--dwc-border-radiusDefault border radius
--dwc-border-widthDefault border width
--dwc-shadow-mMedium drop shadow
--dwc-shadow-lLarge drop shadow (e.g., modals)

See each component's API page for the specific tokens it supports.

Customizing Tokens

Global Override

Apply token overrides at the document level using the :root selector:

:root {
--dwc-color-primary: #3b82f6; /* Custom blue */
--dwc-border-radius: 4px; /* Sharper corners */
--dwc-font-family: 'Inter', sans-serif;
}

Per-Component Override

Override tokens for a specific component instance using CSS on the element:

/* All sp-org-chart instances */
sp-org-chart {
--dwc-color-primary: #10b981;
}

/* A specific instance */
sp-org-chart#my-chart {
--dwc-border-radius: 0;
}

Dark Mode

Components support dark mode via the theme-dark CSS class on the host element. Apply it directly:

<sp-org-chart class="theme-dark"></sp-org-chart>

Or apply it at the document level to affect all components at once:

// Toggle dark mode across all sp-* components on the page
document.querySelectorAll('sp-org-chart, sp-walkthrough, sp-markdown-editor').forEach(el => {
el.classList.toggle('theme-dark');
});

Internally, dark mode is handled via :host(.theme-dark) CSS selectors inside each component's Shadow DOM:

/* Inside the component's shadow CSS */
:host {
--component-bg: #ffffff;
}
:host(.theme-dark) {
--component-bg: #1e1e1e;
}

CSS Parts

CSS ::part() selectors allow you to style specific internal elements of a component that the component author has deliberately exposed.

Example: Styling sp-org-chart Parts

/* Style the user tile card */
sp-org-chart::part(user-tile) {
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Style the connector lines */
sp-org-chart::part(connector) {
border-color: #6366f1;
}

Available parts for each component are listed in the CSS Parts section of each component's API reference page.

sp-walkthrough has no CSS parts

sp-walkthrough is a floating overlay panel and does not expose any CSS parts. Use CSS custom properties (--dwc-*) to theme it instead.

Integration with DWC

If your application already loads the full DWC theme stylesheet, Skillspilot components will automatically inherit all DWC token values. No additional configuration is needed — the components consume the same tokens that DWC already defines.

<!-- If you already have this in your app, components are fully themed -->
<link rel="stylesheet" href="path/to/dwc-theme.css" />