Dark Mode

PreviousNext

Complete dark mode system in ZardUI using TailwindCSS v4 custom variants and DarkModeService for seamless theme switching.

ZardUI implements a robust dark mode system using @custom-variant dark from TailwindCSS v4 combined with an Angular DarkModeService for state management and persistence.

Current Implementation Status
Currently, dark mode works via CSS class variations. In the future, we plan to add a CLI option for automatic service installation.

Current Implementation

The current system works by applying the .dark class to the root HTML element, activating all dark style variations defined in the components.

DarkMode Service

The core of the system is an Angular service that manages theme state, persistence, and CSS class application.

Loading...

Usage in Application

See how the service is used in the AppComponent for initialization and in the HeaderComponent for toggle control.

App Component

Loading...

Header Component

Loading...

Interactive Demo

Test the dark mode system in action and see how components react to theme changes.

Theme Control

Current theme: system

🌙 Dark Mode

Card Example

This card automatically changes with the theme.

Muted Background

Background with responsive opacity.

Primary Colors

Primary colors adapted to theme.