Skip to content
⭐ Loving ngx-theme-stack? Support us with a star on GitHub!

Quick Start

The fastest way to add theme management to your Angular 20+ application.

Run the following command to install the library and automate the initial configuration:

Terminal window
ng add ngx-theme-stack

During installation, choose the Quick Mode for instant setup with default themes (light, dark, system).

The installation creates a src/themes.css file. This is where you define your theme variables:

src/themes.css
:root {
--primary: #6c00f9;
}
[data-theme='dark'] {
--primary: #ff0069;
}

Inject the ThemeToggleService anywhere in your application to switch between themes:

import { Component, inject } from '@angular/core';
import { ThemeToggleService } from 'ngx-theme-stack';
@Component({
selector: 'app-theme-toggle',
template: `
@if (themeToggle.isHydrated()) {
<button (click)="themeToggle.toggle()">
Theme: {{ themeToggle.resolvedTheme() }}
</button>
} @else {
<!-- Skeleton loader while the app hydrates -->
<div class="skeleton-toggle"></div>
}
`
})
export class ThemeToggleComponent {
protected themeToggle = inject(ThemeToggleService);
}

Want to know more? Check out the full guide or explore specific utilities.