Skip to content

fix(material/schematics): always add a custom theme with ng add #31522

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

andrewseguin
Copy link
Contributor

@andrewseguin andrewseguin commented Jul 10, 2025

ng add no longer provides options to include the prebuilt themes. Instead, always add a custom theme with user-specified palettes

The prompt is still present as it is today, except without the "custom" option, so users are still picking between four pairs of palettes as seen on material.angular.dev

// Include theming for Angular Material with `mat.theme()`.
// This Sass mixin will define CSS variables that are used for styling Angular Material
// components according to the Material 3 design spec.
// Learn more about theming and how to use it for your application's
// custom components at https://material.angular.dev/guide/theming
@use '@angular/material' as mat;

html {
  @include mat.theme((
    color: (
      primary: mat.$azure-palette,
      tertiary: mat.$blue-palette,
    ),
    typography: Roboto,
    density: 0,
  ));

  // Default the application to a light color theme. This can be changed to
  // `dark` to enable the dark color theme, or to `light dark` to defer to the
  // user's system settings.
  color-scheme: light;

  // Set a default background, font and text colors for the application using
  // Angular Material's system-level CSS variables. Learn more about these
  // variables at https://material.angular.dev/guide/system-variables
  background-color: var(--mat-sys-surface);
  color: var(--mat-sys-on-surface);
  font: var(--mat-sys-body-medium);
}

Also, remove the option to insert typography styles. Users should just use the system variables defined in the theming docs

@andrewseguin andrewseguin requested a review from a team as a code owner July 10, 2025 22:03
@andrewseguin andrewseguin requested review from adolgachev and ok7sai and removed request for a team July 10, 2025 22:03
@andrewseguin andrewseguin added the target: patch This PR is targeted for the next patch release label Jul 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant