A powerful, flexible theming system for Angular Material!
Easily add a dark mode toggle to your application with smooth transitions.
Let users choose from predefined themes, including your seasonal options.
Allow users to create and save their own custom themes.
Showcase multiple independently themed sections on a single page. Each card demonstrates local theme and dark mode switching.
The library is designed for optimal performance and reduced bundle size:
ng add @angular/material
Option 2: Manual installation with version matching # To default to the version that matches your current angular version (Will work if you're using Angular 17, 18 or 19)
npm install @angular/material @angular/cdk
# For Angular 17
npm install @angular/material@17 @angular/cdk@17
# For Angular 18
npm install @angular/material@18 @angular/cdk@18
# For Angular 19
npm install @angular/material@19 @angular/cdk@19
Define your themes by providing just a few seed colors (primary, secondary, tertiary). The library automatically generates the full Material Design 3 tonal palettes (like primary-container, on-primary, etc.) at runtime, eliminating the need to manually define complex palettes like in traditional Angular Material theming.
To customize Material button and FAB colors with your theme’s CSS variables, import the provided SCSS overrides in your global or feature styles:
This will asllow you apply your theme’s primary, secondary, tertiary, and error colors to all Material buttons, FABs and other Mat Components using CSS variables. You can see this in action in our Theme Showcase
demo.
Below you can see the code to use a themed button, and the actual result: class="primary-palette"
will apply the color var(--mat-sys-primary)
to the button background and var(--mat-sys-on-primary)
to the text color. class="secondary-palette"
will apply the color var(--mat-sys-secondary)
to the button background and var(--mat-sys-on-secondary)
to the text color.
etc...
Allow users to change Themes and Dark Mode.
To set a local theme for a specific component and its children. Isoloated from outer themes.
To allow users to create custom themes, add this to your component template.
You can see it in action here Custom Themes
To demonstrate current theme and dark mode on material components, add this to your component template.
You can see it in action below (Theme Preview).
For detailed information about all available methods and properties, see the ThemeService API Documentation
The ThemeService provides methods for applying themes, switching between light and dark mode, creating custom themes, and more. Explore the complete API to get the most out of the theming system.
ThemeService
is injected at least once in your app, SbThemePickerMatComponent
or SbDarkModeToggleMatComponent
. provideThemeInitializer()
to your app’s providers.
Download ready-to-use configuration files to get started quickly with SpiderBaby Material Theming:
Basic theme configuration with sample themes
Ready-to-use SCSS configuration for Material themes
Configuration setup for Angular providers
All configuration files in one download
For more information about the available options and API, check out the Complete API Documentation
Unlike traditional Angular Material theming, this library uses CSS variables to apply themes at runtime:
Theme colors are exposed via both Material Design and custom CSS variables:
--mat-sys-primary
- Material design system colors --mat-sys-secondary
- Material design system colors --mat-sys-tertiary
- Material design system colors --mat-seed-primary
- Original theme seed colors --mat-seed-secondary
- Original theme seed colors --mat-seed-tertiary
- Original theme seed colors --mat-sys-primary-40
- Primary color palette (40) Access any tone with var(--mat-sys-primary-[tone])
Access any tone with var(--mat-sys-secondary-[tone])
Access any tone with var(--mat-sys-tertiary-[tone])
Access any tone with var(--mat-sys-error-[tone])
Access any tone with var(--mat-sys-neutral-[tone])
User preferences are automatically saved between sessions:
Create unique theme contexts for different sections of your application:
See how Material components look with the currently selected theme:
The source code for this library is available on GitHub. Feel free to: