From 52f8a365bd378e36dccbcb18c4257beed0c04a0b Mon Sep 17 00:00:00 2001 From: Andrew Seguin Date: Fri, 8 Nov 2024 14:22:14 -0700 Subject: [PATCH 1/2] fix(material/core): change ng-add to use mat.theme --- .../ng-add/theming/create-custom-theme.ts | 38 ++++++------------- 1 file changed, 11 insertions(+), 27 deletions(-) diff --git a/src/material/schematics/ng-add/theming/create-custom-theme.ts b/src/material/schematics/ng-add/theming/create-custom-theme.ts index 0e8386421146..b75880360b06 100644 --- a/src/material/schematics/ng-add/theming/create-custom-theme.ts +++ b/src/material/schematics/ng-add/theming/create-custom-theme.ts @@ -12,32 +12,16 @@ export function createCustomTheme(name: string = 'app') { // Custom Theming for Angular Material // For more information: https://material.angular.io/guide/theming @use '@angular/material' as mat; -// Plus imports for other components in your app. -// Define the theme object. -$${name}-theme: mat.define-theme(( - color: ( - theme-type: light, - primary: mat.$azure-palette, - tertiary: mat.$blue-palette, - ), - density: ( - scale: 0, - ) -)); - -// Include theme styles for core and each component used in your app. -// Alternatively, you can import and @include the theme mixins for each component -// that you are using. -:root { - @include mat.all-component-themes($${name}-theme); -} - -// Comment out the line below if you want to use the pre-defined typography utility classes. -// For more information: https://material.angular.io/guide/typography#using-typography-styles-in-your-application. -// @include mat.typography-hierarchy($${name}-theme); - -// Comment out the line below if you want to use the deprecated \`color\` inputs. -// @include mat.color-variants-backwards-compatibility($${name}-theme); -`; +html { + @include mat.theme(( + color: ( + theme-type: light, + primary: mat.$azure-palette, + tertiary: mat.$blue-palette, + ), + typography: Roboto, + density: 0, + )); +}`; } From 170b3972c7263592a9966cb2aeee9517d10181fc Mon Sep 17 00:00:00 2001 From: Andrew Seguin Date: Fri, 8 Nov 2024 15:02:27 -0700 Subject: [PATCH 2/2] fix(material/core): tests --- src/material/schematics/ng-add/index.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/material/schematics/ng-add/index.spec.ts b/src/material/schematics/ng-add/index.spec.ts index 28d0a4ee8200..803a9d243604 100644 --- a/src/material/schematics/ng-add/index.spec.ts +++ b/src/material/schematics/ng-add/index.spec.ts @@ -124,7 +124,7 @@ describe('ng-add schematic', () => { const themeContent = buffer!.toString(); expect(themeContent).toContain(`@use '@angular/material' as mat;`); - expect(themeContent).toContain(`$material-theme: mat.define-theme((`); + expect(themeContent).toContain(`@include mat.theme((`); }); it('should create a custom theme file if no SCSS file could be found', async () => {