Skip to content

Commit 4f52732

Browse files
andrewseguinAndrew Seguin
authored andcommitted
fix(material/schematics): access custom as a theme palette (#31555)
Co-authored-by: Andrew Seguin <[email protected]> (cherry picked from commit f0accd1)
1 parent af6cb6d commit 4f52732

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/material/schematics/ng-add/theming/theming.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,16 @@ const defaultCustomThemeFilename = 'custom-theme.scss';
3030
/** Add pre-built styles to the main project style file. */
3131
export function addThemeToAppStyles(options: Schema): Rule {
3232
return (host: Tree, context: SchematicContext) => {
33-
const palettes = options.theme || 'azure-blue';
33+
let palettes = options.theme || 'azure-blue';
34+
35+
// For a long time, theme param could be "custom" which meant to add a custom theme. This option
36+
// was removed since we always add a custom theme, and we expect this option to be the
37+
// user's preferred palettes. However it's possible that users will have hardcoded CLI commands
38+
// that pass "--theme custom" and we can gracefully handle this by assuming azure-blue.
39+
if (palettes === 'custom') {
40+
palettes = 'azure-blue';
41+
}
42+
3443
return insertCustomTheme(palettes, options.project, host, context.logger);
3544
};
3645
}

0 commit comments

Comments
 (0)