theming / Function

provideTheme

Make providers that consume the given list of theme token generation specifications by generating and applying the latest theme tokens as specified.

See Also

Presentation

Returns

Parameters

NameTypeDescription
compositions
Observable<ThemeBuilderComposition>[]

list of theme token generation specifications

Example usage

providers: [
  provideTheme(
    withThemeBuilder("typography", TypographyBuilder, {
      font: "OpenSans"
    }),
    withThemeBuilder(
      'color',
      ColorBuilder,
      defer((schemeObserver = inject(PreferredColorSchemeObserver)) =>
        schemeObserver
          .observe()
          .pipe(map((isDark) => ({ primaryColor: PRIMARY_COLOR, dark: isDark }))),
      ),
    ),
  ),
],