Skip to content DS OneTheming | DS one
DS one

Theming

DS One uses CSS custom properties (variables) for theming, making it easy to customize colors, spacing, and other design tokens.

Change the primary accent color:

:root {
--accent-color: #0066cc;
}

DS One automatically detects and responds to system dark/light mode preferences.

:root {
--accent-color: #0066cc;
--background-color: #ffffff;
--text-color: #000000;
--border-color: #e0e0e0;
}
:root {
--font-family: "GT America", system-ui, sans-serif;
--font-size-base: 16px;
--line-height: 1.5;
}
:root {
--spacing-xs: 4px;
--spacing-sm: 8px;
--spacing-md: 16px;
--spacing-lg: 24px;
--spacing-xl: 32px;
}

DS One components automatically adapt to dark mode:

@media (prefers-color-scheme: dark) {
:root {
--background-color: #1a1a1a;
--text-color: #ffffff;
--border-color: #333333;
}
}
ds-button[variant="primary"] {
--button-background: var(--accent-color);
--button-text: white;
}

Each page or component can have its own accent color:

<div style="--accent-color: #ff6b6b;">
<ds-button variant="primary">Red Button</ds-button>
</div>
:root {
/* Primary brand color */
--accent-color: #6366f1;
/* Secondary colors */
--color-success: #10b981;
--color-warning: #f59e0b;
--color-error: #ef4444;
}
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap");
:root {
--font-family: "Inter", sans-serif;
}
  1. Define theme variables at the :root level
  2. Use semantic variable names
  3. Test in both light and dark modes
  4. Maintain sufficient contrast ratios for accessibility