Debase UI

Theming

Debase UI uses a very simple theming mechanism.

The styling across the components is unified through a well-defined list of CSS variables.
These variables serve a functional role as design tokens rather than hue values, for example "color-text" and not "primary-500".

Default Theme

Following the Installation guide, you should have defined the default variables in your project.

Customize the Theme Values

Once the default theme is set up, you can modify values based on your preferences.

You can edit the values directly; however, a cleaner approach is to overwrite them without changing the original, allowing you to keep track of your customizations. Here are different examples of overwrites.

Try it live:

... and more

Adopt Multiple Themes

One cool trick is that you can also add multiple themes. You can implement Light and Dark modes easily. Or, just like this website, let the visitor choose their theme on demand.

To achieve this, you can overwrite the variables conditionally.

As an example, this website uses a simple function to change the class applied to the root HTML element and juggle between different themes.

List of Design Tokens

Here is the list of all the design tokens that are available in the default theme.

--debase__color__textMain text color.
--debase__color__text-subSub-text color.
--debase__color__lineColor for borders and dividers.
--debase__color__backgroundMain background color.
--debase__color__background-subSecondary background color for contrast areas.
--debase__color__primaryPrimary brand color for buttons and interactive elements.
--debase__color__primary-labelText color compatible with primary color.
--debase__color__successColor for success states and confirmations.
--debase__color__success-labelText color compatible with success color.
--debase__color__warningColor for warning states and cautionary actions.
--debase__color__warning-labelText color compatible with warning color.
--debase__color__dangerColor for error states and destructive actions.
--debase__color__danger-labelText color compatible with danger color.
--debase__spacing__x05Extra small spacing (4px).
--debase__spacing__x1Small spacing (8px).
--debase__spacing__x2Medium spacing (16px).
--debase__spacing__x3Large spacing (24px).
--debase__spacing__x4Extra large spacing (32px).
--debase__spacing__x52x extra large spacing (40px).
--debase__spacing__x63x extra large spacing (48px).
--debase__spacing__x74x extra large spacing (56px).
--debase__spacing__x85x extra large spacing (64px).
--debase__font-size__normalStandard font size for body text.
--debase__font-size__smallFont size for small text elements like captions.
--debase__font-size__title1Font size for primary headings.
--debase__font-size__title2Font size for secondary headings.
--debase__font-size__title3Font size for tertiary headings.
--debase__font-familyDefault font family with fallbacks.
--debase__radiusDefault border radius for elements.
--debase__radius-strongLarger border radius for emphasis.