Back to results for “Deployment”
Angular › Angular Material Theming

What is a theme in Angular Material and how do you apply one to your app?

Beginner

Answer

A theme defines the colors, typography, and density used across every Angular Material component in your app. You either use one of the prebuilt themes that ship with Angular Material, or define your own custom theme using Sass, then include it once in your project's global styles file.
// styles.scss
@use '@angular/material' as mat;

$my-theme: mat.define-theme();

html {
  @include mat.all-component-themes($my-theme);
}
Real-world example A company applies a consistent brand color theme across their entire Angular Material based dashboard by defining one custom theme file, instantly changing the color of every button, input, and dialog throughout the app.

Common follow-ups: What is the difference between using a prebuilt theme and defining a custom one?;How do you support both a light and dark theme in the same app?