Theming

Customize all the libraries at once from a single place. The design system exposes the hub.theme(...) mixin, which takes your packs (colors, spacers, radii, typography) as maps and loops over them to emit the --hub-* tokens the whole family reads. Change an accent and its role family is recalculated; change a spacer and everything that depends on it is re-derived.

The mental model

Components never hard-code colors: they read tokens. There are two layers, --hub-ref-* (primitives: spacing scale, radii, typography) and --hub-sys-* (semantic: primary, success, danger…). Each component hangs from them through the var() chain, so customizing the design system re-tones the whole ecosystem without touching any single library.

  • One accent → its whole role family (-subtle / -emphasis / -on) is recalculated at runtime with color-mix.
  • One reference token (a spacing step, a radius) → every alias, utility and component that uses it is re-derived.
  • Runtime vs compile-time: colors, spacers, radii and typography are CSS variables (runtime, with hub.theme). The breakpoints and which utility steps exist are compile-time, because media queries do not accept var().

1 · Your packs at runtime — hub.theme(...)

Import the design system once and pass only the overrides you want, as maps. The mixin runs @each internally and emits the canonical --hub-* tokens; anything you leave out keeps its base value.

@use 'ng-hub-ui-ds' as hub;

// Tu pack de marca
$brand: (
  primary: #0f766e,
  brand:   #14b8a6,
  success: #15803d,
  danger:  #b91c1c
);

:root {
  @include hub.theme(
    $accents: $brand,                          // → --hub-sys-color-*  (familia -subtle/-emphasis/-on por color-mix)
    $space:   (2: 0.375rem, 3: 0.75rem, 4: 1.25rem),  // → --hub-ref-space-*
    $radius:  (md: 0.5rem, lg: 1rem),                 // → --hub-ref-radius-*
    $font-family: (base: 'Inter, system-ui, sans-serif')
  );
}

The result: a single pack re-tones every component at once. Switch packs and watch buttons, badges and the surface follow the same tokens (colors and radii):

PrimarySuccessDanger
Surface card
Radius and spacing follow --hub-ref-radius-* / --hub-ref-space-*.

2 · Compile-time — @use … with (…)

What cannot be a CSS variable is configured through the module system: the breakpoints (they regenerate the responsive utilities with @each $bp in $hub-breakpoints), extra accents registered at compile time, or which steps exist.

@use 'ng-hub-ui-ds' as hub with (
  $hub-breakpoints:   (sm: 576px, md: 768px, lg: 1200px, xl: 1600px),
  $hub-accents-extra: (brand: #ff6b00)
);

3 · Your own loop over each library's mixins

Besides global theming, each library exposes its own hub-<lib>-theme mixin. Loop your pack over it with @each to mint per-component variants in a single pass:

@use 'ng-hub-ui-badges/styles' as badges;

$brand: (teal: #0f766e, sunset: #ff6b00, plum: #7c3aed);

@each $name, $hex in $brand {
  .badge--#{$name} {
    @include badges.hub-badge-theme($accent: $hex);
  }
}

4 · Multi-theme and scoped

hub.theme can be applied on :root, in a [data-theme] block, or scoped to any subtree; it composes with the base tokens and with other themes.

@use 'ng-hub-ui-ds' as hub;

[data-theme='compact'] {
  @include hub.theme(
    $space:  (3: 0.5rem, 4: 0.75rem),
    $radius: (md: 0.25rem)
  );
}

5 · Glass layer

Floating surfaces (modal, dropdown, select and datepicker panels, toast) can be translucent and blurred. It is off by default: use data-theme="glass", or add data-hub-glass to any ancestor to put it over another theme. --hub-sys-glass-strength (0 to 1) sets how much.

<html data-theme="glass">
<!-- or over another theme: -->
<html data-theme="dark" data-hub-glass style="--hub-sys-glass-strength: 0.7">

A component of your own opts in with the hub-glass-surface class and reads the derived values with an opaque fallback. Surfaces go back to opaque with reduced transparency, more contrast, forced colours or no backdrop-filter. In-flow surfaces such as cards are translucent but not blurred. The pointer sheen needs provideHubGlassLight() from ng-hub-ui-utils.

.my-panel {
  background-color: color-mix(in srgb, var(--hub-sys-surface-elevated) var(--hub-sys-glass-opacity, 100%), transparent);
  background-image: var(--hub-sys-glass-sheen, none);
  backdrop-filter: var(--hub-sys-glass-filter, none);
  box-shadow: var(--hub-sys-glass-rim, 0 0 #0000), var(--hub-sys-shadow-md);
}

And per component

To adjust a single library in a specific place, each one documents its mixin and variables in its Styles tab.