diff --git a/src/material/schematics/ng-add/theming/theming.ts b/src/material/schematics/ng-add/theming/theming.ts index ed9263dfd49a..7486d1b61114 100644 --- a/src/material/schematics/ng-add/theming/theming.ts +++ b/src/material/schematics/ng-add/theming/theming.ts @@ -30,7 +30,16 @@ const defaultCustomThemeFilename = 'custom-theme.scss'; /** Add pre-built styles to the main project style file. */ export function addThemeToAppStyles(options: Schema): Rule { return (host: Tree, context: SchematicContext) => { - const palettes = options.theme || 'azure-blue'; + let palettes = options.theme || 'azure-blue'; + + // For a long time, theme param could be "custom" which meant to add a custom theme. This option + // was removed since we always add a custom theme, and we expect this option to be the + // user's preferred palettes. However it's possible that users will have hardcoded CLI commands + // that pass "--theme custom" and we can gracefully handle this by assuming azure-blue. + if (palettes === 'custom') { + palettes = 'azure-blue'; + } + return insertCustomTheme(palettes, options.project, host, context.logger); }; }