components: bug(theming): WARNING: var(--primary, #4bcd3e) is not a color. Falling back to "dark" tone.

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

We are getting error in below code -

@include mat.all-legacy-component-themes($theme);

$theme contains custom color palettes configuration which used to work properly in v14 without any warnings.

After migrating angular v14 to v15rc, we are getting following error (adding only one error as other errors are similar but with different css var color) -

[build:demothemes] WARNING: var(--primary, #4bcd3e) is not a color. Falling back to "dark" tone.
[build:demothemes]     node_modules\@material\theme\_theme-color.scss 67:5                           tone()
    node_modules\@material\theme\_theme-color.scss 86:14                          contrast-tone()
    node_modules\@angular\material\core\mdc-helpers\_mdc-helpers.scss 123:10      using-mdc-theme()
    node_modules\@angular\material\button\_icon-button-theme.scss 13:3            color()
    node_modules\@angular\material\button\_icon-button-theme.scss 68:7            @content
    node_modules\@angular\material\core\theming\_theming.scss 402:3               private-check-duplicate-theme-styles()
    node_modules\@angular\material\button\_icon-button-theme.scss 62:3            theme()
    node_modules\@angular\material\datepicker\_datepicker-legacy-compat.scss 7:5  legacy-button-compat-theme()
    node_modules\@angular\material\legacy-button\_button-theme.scss 168:3         color()
    node_modules\@angular\material\legacy-button\_button-theme.scss 214:7         @content
    node_modules\@angular\material\core\theming\_theming.scss 402:3               private-check-duplicate-theme-styles()
    node_modules\@angular\material\legacy-button\_button-theme.scss 208:3         theme()
    node_modules\@angular\material\legacy-core\theming\_all-theme.scss 45:5       @content
    node_modules\@angular\material\core\theming\_theming.scss 402:3               private-check-duplicate-theme-styles()
    node_modules\@angular\material\legacy-core\theming\_all-theme.scss 43:3       all-legacy-component-themes()
    libs\prebuilt-themes\default.scss 125:1                                   @use
    libs\prebuilt-themes\default-css-vars.scss 5:1                            @use
    apps\ruf-app\src\app\custom-themes\default.scss 3:1                       root stylesheet

Reproduction

Steps to reproduce: 1. 2.

Expected Behavior

NA

Actual Behavior

NA

Environment

Angular: 15.0.0-rc.4 CDK/Material: 15.0.0-rc.3 Browser(s): Chrome Operating System (e.g. Windows, macOS, Ubuntu): Windows

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 77
  • Comments: 87 (11 by maintainers)

Commits related to this issue

Most upvoted comments

To clarify: we never officially supported CSS variables as palette values, primarily because the theming system was written during the time when we had to support IE 11. Before the switch to MDC there were only 2-3 places that broke when provided with a CSS variable which were easy to fix so we fixed them. After the switch to MDC that’s no longer the case since a lot of the CSS comes from outside of our project.

It’s not just the palette values - I’m seeing breakage in regular colors as well (e.g card background). I would also have thought that given there is an open issue to support css variables you would work towards supporting it, and not make active changes to break it. The breaking happens primarily in your usage of sass’ color mixins (e.g _card-theme.scss, outline-color: color.mix(mdc-theme-color.prop-value(on-surface),), which I think it’s odd to “blame” on the styling from MDC.

That being said, we’re in the process of designing a new theming system that will be based on CSS variables.

That’s good to know, but can this be expected in this major, or would it need to wait several more majors? The issue I linked above talking about it is 5 years old, and for myself and my projects this is blocking our migration to angular 15.

I’ve merged in #26260 for the 15.0.3 release that should resolve most of the issues. It fixes all the compilation errors when passing in a CSS-variable-based theme both into the MDC and legacy components. Also all the warnings should be gone for the legacy components while there are ~4 warnings left for the MDC ones that we can’t do much about at the moment. When we switch the select, menu, list and autocomplete to the new token-based theming API, the warnings will go away.

To clarify: we never officially supported CSS variables as palette values, primarily because the theming system was written during the time when we had to support IE 11. Before the switch to MDC there were only 2-3 places that broke when provided with a CSS variable which were easy to fix so we fixed them. After the switch to MDC that’s no longer the case since a lot of the CSS comes from outside of our project.

That being said, we’re in the process of designing a new theming system that will be based on CSS variables.

We are having the same issues after upgrading to v15.

Would be great to share if there is any progress on this issue. It is blocking our team to migrate to the new mdc version of the material components. We are also using the angular-material-css-vars for dynamic theming with CSS vars.

Hi Angular community,

These are my observations regarding the use of CSS Custom Properties with Angular Material 15.0 palettes.

If our Angular Material palettes use CSS Custom Properties, the easiest path for migrating to Angular Material 15 is the following:

  1. Use legacy Angular Material declarables and styles when both a legacy variant and an MDC-based variant exists.
  2. Adress the style issues described in the section Datepicker.
  3. Wait for MDC-based Angular Material components to support CSS Custom Properties theming.

Overview of Angular Material 15 components

Component Legacy variant MDC-based variant Shared variant*
Autocomplete x x
Button x x
Card x x
Checkbox x x
Chips x x
Dialog x x
Form field x x
Input x x
List x x
Menu x x
Paginator x x
Progress bar x x
Progress spinner x x
Radio button x x
Ripples x x
Select x x
Slide toggle x x
Slider x x
Snackbar x x
Table x x
Tabs x x
Tooltip x x
Badge x
Bottom sheet x
Button toggle x
Core x
Datepicker** x
Divider x
Expansion panel x
Grid list x
Icon x
Sidenav x
Sort header x
Stepper x
Toolbar x
Tree x

* Shared variant means that we will use the same variant for both legacy and MDC-based Angular Material setups as MDC for Web has no equivalent component. ** The Datepicker uses MDC-based Button and Icon button components and styles as described in the section Datepicker.

Datepicker

  1. Datepicker uses MDC-based Button and Icon button components and styles. The toggle button as well as the previous and next period buttons in the calendar popup are MDC-based Icon buttons. The period selector buttons in the calendar popup are MDC-based Buttons. Some of their styles fail to detect dark/light text when our palette uses CSS Custom Properties which causes warnings.

MDC-based Angular Material components

  1. All MDC-based Angular Material components except for Paginator have styles that fail to detect dark/light text when our palette uses CSS Custom Properties, causing build warnings when serving our application.
  2. Paginator styles fail to compile when our palette uses CSS Custom Properties, causing our application’s serve and build to break.

To use CSS Custom Properties with MDC-based Angular Material components, we must address style issues caused by (1) when our palette includes dark background colors.

We cannot use CSS Custom Properties with the MDC-based Paginator as described by (2).

Hi, this does look like an example of Hyrum’s law. We never officially supported this but it appears a good number of users have ended up depending on it. I rediscussed this with the team and the current plan is still to roll forward and let this be resolved by the new token-based theming api. Our reason for this is that the rollout of the new api is our best real solution to actually supporting this behavior. It also resolves multiple other issues and provides users with a much better supported solution for customizing component styles

From my tracing / understanding, a good chunk of warnings are coming from trying to calculate things like contrast colors at scss compile time, even though the contrasting colors should also be available in the palette color config (which presumably those of us using dynamic CSS vars have those as variables as well as the color). But those are just warnings that don’t prevent it from building, I just fear there may be places the wrong contrasting colors are ending up.

For things that actually are breaking, as a workaround I am either using the legacy component/mixin or attempting to emit overriding styles without calling the material mixin. In essence:

@include mat.badge-theme($theme);
@include mat.button-theme($theme);
@include mat.form-field-theme($theme); // aside - IDE complains but this compiles?
@include mat.legacy-progress-bar-theme($theme);

which seems to be ok for now with the caveat the associated (deprecated) legacy module is imported:

import { MatLegacyProgressBarModule as MatProgressBarModule } from "@angular/material/legacy-progress-bar";

The other component I found so far that isn’t playing nicely is the slide-toggle. No compilation errors but renders using whatever the presumed initial colors/styles are.

Anyways, understood that using CSS vars in our theme configs was not officially supported by the angular material API (and the difficulties with integrating with the mdc sass). However, for those of us who had requirements of a dynamic theme where it was important enough to use CSS vars in our theme configs, I think we are looking for some advising on how to manage planning apps and upgrading to Angular 15. My initial thoughts/questions:

  • If we upgrade to Angular 15 and do patchwork / legacy imports as necessary…
    • Is there potential for significantly more breakages during v15 that this maintenance on our end becomes a hassle?
    • Will support for dynamic runtime themes (or at least support for us to use CSS vars in configs) be available before legacy component modules are dropped from the API (looks like v17 it disappears)?
    • How bad is it in general to be relying on a few legacy component module imports?
    • Is there any comprehensive list of what components need to go through legacy in order to function/style properly with CSS vars for the colors?
  • If we stay on Angular 14…
    • Any idea for what major release the CSS vars / dynamic theme features could work with material out of the box? Don’t want to fall behind, especially with other third party libraries that may not have the same level of support for older versions that angular would

I’m getting error var(--theme-primary-500) is not a color. It seems like we can’t use CSS variables anymore with Material themes?

Dynamic theme is inspired by https://stackblitz.com/edit/angular-material-theming-playground?file=src%2Fstyles%2F_var.scss

$dynamic-theme-primary: (
  50 : var(--theme-primary-50),
  100 : var(--theme-primary-100),
  200 : var(--theme-primary-200),
  300 : var(--theme-primary-300),
  400 : var(--theme-primary-400),
  500 : var(--theme-primary-500),
  600 : var(--theme-primary-600),
  700 : var(--theme-primary-700),
  800 : var(--theme-primary-800),
  900 : var(--theme-primary-900),
  A100 : var(--theme-primary-A100),
  A200 : var(--theme-primary-A200),
  A400 : var(--theme-primary-A400),
  A700 : var(--theme-primary-A700),
  contrast: (
    50: var(--theme-primary-contrast-50),
    100: var(--theme-primary-contrast-100),
    200: var(--theme-primary-contrast-200),
    300: var(--theme-primary-contrast-300),
    400: var(--theme-primary-contrast-400),
    500: var(--theme-primary-contrast-500),
    600: var(--theme-primary-contrast-600),
    700: var(--theme-primary-contrast-700),
    800: var(--theme-primary-contrast-800),
    900: var(--theme-primary-contrast-900),
    A100: var(--theme-primary-contrast-A100),
    A200: var(--theme-primary-contrast-A200),
    A400: var(--theme-primary-contrast-A400),
    A700: var(--theme-primary-contrast-A700),
  )
);
Warning: Module Warning (from ./node_modules/sass-loader/dist/cjs.js):
var(--theme-primary-500) is not a color. Falling back to "dark" tone.      

@material/theme/_theme-color.scss 67:5                                     
tone()
@material/theme/_theme-color.scss 86:14                                    
contrast-tone()
node_modules/@angular/material/core/mdc-helpers/_mdc-helpers.scss 123:10   using-mdc-theme()
node_modules/@angular/material/progress-bar/_progress-bar-theme.scss 26:3  color()
node_modules/@angular/material/progress-bar/_progress-bar-theme.scss 53:7  @content
node_modules/@angular/material/core/theming/_theming.scss 402:3            
private-check-duplicate-theme-styles()
node_modules/@angular/material/progress-bar/_progress-bar-theme.scss 47:3  theme()
node_modules/@angular/material/core/theming/_all-theme.scss 47:5           
@content
node_modules/@angular/material/core/theming/_theming.scss 402:3            
private-check-duplicate-theme-styles()
node_modules/@angular/material/core/theming/_all-theme.scss 44:3           
all-component-themes()
@import
src/scss/styles.scs
Warning: Module Warning (from ./node_modules/sass-loader/dist/cjs.js):
var(--theme-primary-500) is not a color. Falling back to "dark" tone.      

@material/theme/_theme-color.scss 67:5                                    tone()
@material/theme/_theme-color.scss 86:14                                   contrast-tone()
node_modules/@angular/material/core/mdc-helpers/_mdc-helpers.scss 123:10  using-mdc-theme()
node_modules/@angular/material/card/_card-theme.scss 16:3                 color()
node_modules/@angular/material/card/_card-theme.scss 70:7                 @content
node_modules/@angular/material/core/theming/_theming.scss 402:3           private-check-duplicate-theme-styles()
node_modules/@angular/material/card/_card-theme.scss 64:3                 theme()
node_modules/@angular/material/core/theming/_all-theme.scss 46:5          @content
node_modules/@angular/material/core/theming/_theming.scss 402:3           private-check-duplicate-theme-styles()
node_modules/@angular/material/core/theming/_all-theme.scss 44:3          all-component-themes()
src/scss/styles.scss                                                      root stylesheet

Good to hear that there will be a solution eventually, thanks @wagnermaciel

Is there any observable roadmap you know of, regarding this token-based theming api or related issue or whatever to keep track of it?

We are using this theme initialization since, I think, the very first Angular Material version.

We really need this fixed and supported since our applications make intensive use of dynamic, multi-theme features.

Thanks!

FWIW, there is a comment in the Angular Material source at the specific theme for the progress bar that causes this error, explicitly stating that it isn’t possible to use CSS variables.

src/material/progress-bar/_progress-bar-theme.scss:8-22

@mixin _palette-styles($color) {
  // We can't set the `track-color` using `theme`, because it isn't possible for it to use a CSS
  // variable since MDC's buffer animation works by constructing an SVG string from this color.
  @include mdc-linear-progress-theme.theme-styles((
    // TODO(crisbeto): the buffer color should come from somewhere in MDC, however at the time of
    // writing, their buffer color is hardcoded to #e6e6e6 which both doesn't account for theming
    // and doesn't match the Material design spec. For now we approximate the buffer background by
    // applying an opacity to the color of the bar.
    track-color: color.adjust(mdc-theme-color.prop-value($color), $alpha: -0.75),
  ));

  @include mdc-linear-progress-theme.theme((
    active-indicator-color: mdc-theme-color.prop-value($color),
  ));
}

Hello community, I’m using CSS variables in a large Angular app and unfortunately I’m stuck on the upgrade to A15 (sadly, it’s the first time that cannot upgrade).

I’m getting the “…is not a color. Falling back to “dark” tone.” warning all the time. However, the app works and it’s properly styled! But the warning appears all the time and makes unpleasant to work with it.

I appreciate that you’re designing a new theming system based on CSS vars. Nevertheless, on the meantime we need a workaround to skip those warnings, because the app works fine updated to A15.

Can you please help?

Any news about this issue would be really appreciated, because we are unable to upgrade to Angular 15 and like all previous Angular releases we would like to stay updated (from Angular 2 till Angular 14 we had no problems updating, this is the first Angular release which we cannot update)

Just wanted to pop in here and say that we’re seeing the same problem. I’m seeing it elsewhere as well (e.g card-theme, or wherever sass’ color-functions are used). We’re using the themes we build for 15-20 apps, so we’re kinda forced into remaining on angular 14 for now which kinda sucks…

I’m curious why the mdc-components were not rolled out either experimentally, or in a separate package (i.e @angular/mdc) instead of pushing out a pretty big breaking change with no clear migration path.

Hello,

I downgraded to version 14.2.7, I use CSS variables as well and this broke my app. Been for more than 3 hours trying to figure out the issue and then I found @LayZeeDK mastodon post on google search (seems like he quit twitter for good) which pointed to this issue.

Hoping for a fix 😄

Any updates or plans for supporting CSS variables for Angular material theming? Dynamic theming is a real need and it should be supported.

Same here. Stuck with Angular 14 on all our projects due to this restriction. Very very sad when thinking about the huge leaps Angular itself has been making in the last months and will make in the months to come. Angular got momentum - and this bug is holding so many projects back 😦

Is there any official roadmap for this to be tackled any time soon? I’m a bit worried since it seems there is no real alternative to waiting…

I’ve installed Material 15.0.3 and worked like a charm! No more warnings. Many many thanks @crisbeto for your support.

Will it be possible to use CSS variable as a value of design token?

here is my palette:

$primary: mat.define-palette((
  100: rgba(var(--color-primary), 0.1),
  500: rgba(var(--color-primary), 1),
  700: rgba(var(--color-primary), 1),
  contrast: (
    100: rgba(var(--color-primary-contrast), 1),
    500: rgba(var(--color-primary-contrast), 1),
    700: rgba(var(--color-primary-contrast), 1),
  )
))

I’m using @angular/material 15.1.5 and getting this error:

SassError: $color: rgba(var(--color-primary), 1) is not a color.
     ╷
75 │   @return rgba(mdc-theme-color.prop-value($palette), 0.87);
     │           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ╵
  node_modules/@angular/material/form-field/_form-field-native-select.scss 75:11              -get-focused-arrow-color()
  node_modules/@angular/material/form-field/_form-field-native-select.scss 110:20             @content
  node_modules/@angular/material/core/mdc-helpers/_mdc-helpers.scss 193:5                     @content
  node_modules/@angular/material/core/mdc-helpers/_mdc-helpers.scss 233:3                     disable-mdc-fallback-declarations()
  node_modules/@angular/material/core/mdc-helpers/_mdc-helpers.scss 192:3                     using-mdc-theme()
  node_modules/@angular/material/form-field/_form-field-native-select.scss 79:3               private-form-field-native-select-color()
  node_modules/@angular/material/form-field/_form-field-theme.scss 53:7                       @content
  node_modules/@angular/material/form-field/_mdc-text-field-theme-variable-refresh.scss 56:3  private-text-field-refresh-theme-variables()
  node_modules/@angular/material/form-field/_form-field-theme.scss 46:5                       @content
  node_modules/@angular/material/core/mdc-helpers/_mdc-helpers.scss 193:5                     @content
  node_modules/@angular/material/core/mdc-helpers/_mdc-helpers.scss 233:3                     disable-mdc-fallback-declarations()
  node_modules/@angular/material/core/mdc-helpers/_mdc-helpers.scss 192:3                     using-mdc-theme()
  node_modules/@angular/material/form-field/_form-field-theme.scss 45:3                       color()
  node_modules/@angular/material/form-field/_form-field-theme.scss 140:7                      @content
  node_modules/@angular/material/core/theming/_theming.scss 402:3                             private-check-duplicate-theme-styles()
  node_modules/@angular/material/form-field/_form-field-theme.scss 134:3                      theme()
  node_modules/@angular/material/core/theming/_all-theme.scss 49:5                            @content
  node_modules/@angular/material/core/theming/_theming.scss 402:3                             private-check-duplicate-theme-styles()
  node_modules/@angular/material/core/theming/_all-theme.scss 44:3                            all-component-themes()
  src/custom/styles/partials/styles/_style-dark.scss 5:3                                        @import

Does Angular team plan any workaround or fix for this and we should wait or we should remove features with css vars? I really need answer to plan project future. Thanks!

@alorle I saw that you’ve closed the following merge request https://github.com/angular/components/pull/26017.

I do understand the reason, but was wondering if we could add a scss variable that:

  1. is set true per default
  2. When set to false, will ignore and not add the dark fall back.

This way, the user will be able to declare it before the rest & then it would avoid the fallback.

It’s more a workaround, but I do think that a lot of person will be happy with the implementation.
We could add a message in the console that say that this isn’t recommended.

What do you think ?

I’ll be glad to make a pull request in case you’ll accept this.

If I temporarily replace the var(–theme-primary-500) with a static color such as #ff0000, the app compiles, but that breaks the dynamic theming feature, and a warning remains in the console.

Console warning: Deprecation $weight: Passing a number without unit % (60) is deprecated.
./src/scss/styles.scss.webpack[javascript/auto]!=!./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[6].rules[0].oneOf[0].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[6].rules[0].oneOf[0].use[2]!./node_modules/resolve-url-loader/index.js??ruleSet[1].rules[6].rules[1].use[0]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[6].rules[1].use[1]!./src/scss/styles.scss?ngGlobalStyle - Warning: Module Warning (from ./node_modules/sass-loader/dist/cjs.js):
Deprecation $weight: Passing a number without unit % (60) is deprecated.   

To preserve current behavior: $weight * 1%

More info: https://sass-lang.com/d/function-units

@material/slider/_slider-theme.scss 77:5                                   
 @use
node_modules/@angular/material/slider/_slider-theme.scss 3:1               
 @use
node_modules/@angular/material/core/density/private/_all-density.scss 25:1  @forward
@angular/_index.scss 18:1                                                  
 @use
src/scss/my-theme.scss 3:1                                            
 @import
src/scss/styles.scss 2:9                                                   
 root stylesheet

Update: This warning is now gone (in 15.0.1).

So basically only the var(--theme-primary-500) is causing an error in progress-bar… (Using CSS variables for the other values 50-900 doesn’t cause any issues.)

I had the same issue here after upgrading from 14 to 15. Now we downgraded to 14 and will wait for a solution.

@json-derulo “Future: To provide better customization of our Angular material components and enable Material 3 capabilities, we’ll be collaborating with Google’s Material Design team on defining token-based theming APIs.”

That’s pretty vague to be honest 😃

Sorry for too much “spam”. Just want to say I figured it out using separate vars for rgb/rgba wrapping. I still have some wornings related to var(--palette-primary-500-rgb) is not a color. Falling back to "dark" tone. but it’s working. Here the PR for example, if smd else has this issue https://github.com/johannesjo/angular-material-css-vars/pull/104

Also having this issue using css vars. I can’t see an official note if this is going to be resolved? I got the issue loading only the legacy component themes after doing a ng update @angular/material@15

@include mat.all-legacy-component-themes($app-theme);
SassError: $color: HSLA(var(--primary), 1) is not a color.
  ╷
9 │   --mat-mdc-button-ripple-color: #{rgba($color, 0.1)};
  │                                    ^^^^^^^^^^^^^^^^^
  ╵
  node_modules\@angular\material\button\_button-theme-private.scss 9:36         -ripple-color()

Just to sum up, using a CSS variable for the 500 color in the color palette causes 1 error (in progress-bar) and ~28 warnings. Like @mpo-dev mentioned above, the error is caused by this line:

https://github.com/angular/components/blob/e0cccc7fc5454eb7317c201f6f8f92bc058a933a/src/material/progress-bar/_progress-bar-theme.scss#L16

Is it possible to add some fallback to turn this error into a warning, so that v15 apps could compile?

(The custom theming won’t work perfectly as explained by @LayZeeDK above, and the console will be full of warnings, but at least this will mitigate the issue until a proper solution is found.)

1 error ~28 warnings

Yes please, this would help so much… If it’s just one Error, I’m hoping you guys can add a legacy fallback to at least partially support using dynamic themes… We can always override styles if we need to until you are able to officially support it.

You’re right @russcarver, themes defined with CSS variables stopped working with the latest version.

But also the latest version of @anuglar/material introduced migration of almost all components to MDC, in which https://github.com/material-components/material-components-web comes into play.

Same issue here after updating to Angular Material 15, I’m using CSS variables as well to allow for a dynamic theme.

$primary-color: var(--primary-color);
$primary-contrast-color: var(--primary-contrast-color);

$mpo-primary-palette: (
  ...
  500: $primary-color,
 ...
  contrast: (
    ...
    500: $primary-contrast-color,
    ...
  ),
);

@tasbir49 @renatoaraujoc sorry for the late answer, actually it depends on the components and the problems you are facing. I I have faced several issues and for each issue it was a different “solution”. For example, I have given a workaround for this particular issue.

By the way I am also using tailwind + material.

@tasbir49 I am also using dynamic theming and I did manage to upgrade to MDC components with a couple of minor scss hacks. But of course it depends on your applications 🙂

Hey could you share a code example? I use tailwind + material… my colors are all css variables.

Hi there

I have also the same problem as described above after update from material 14 to 15. In our application we use css variables like: --color-1: 10, 10, 10 and we use rgb function in palette definitions. This leads to the following errors:

./src/styles.scss?ngGlobalStyle - Error: Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
HookWebpackError: Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: $color: rgb(var(--primary-color)) is not a color.
  ╷
9 │   --mat-mdc-button-ripple-color: #{rgba($color, 0.1)};
  │                                    ^^^^^^^^^^^^^^^^^
  ╵
  node_modules/@angular/material/button/_button-theme-private.scss 9:36         -ripple-color()
  node_modules/@angular/material/button/_button-theme-private.scss 35:5         ripple-theme-styles()
  node_modules/@angular/material/button/_button-theme.scss 177:7                @content
  node_modules/@angular/material/core/mdc-helpers/_mdc-helpers.scss 193:5       @content
  node_modules/@angular/material/core/mdc-helpers/_mdc-helpers.scss 233:3       disable-mdc-fallback-declarations()
  node_modules/@angular/material/core/mdc-helpers/_mdc-helpers.scss 192:3       using-mdc-theme()
  node_modules/@angular/material/button/_button-theme.scss 43:3                 color()
  node_modules/@angular/material/button/_button-theme.scss 216:7                @content
  node_modules/@angular/material/core/theming/_theming.scss 402:3               private-check-duplicate-theme-styles()
  node_modules/@angular/material/button/_button-theme.scss 210:3                theme()
  node_modules/@angular/material/datepicker/_datepicker-legacy-compat.scss 6:5  legacy-button-compat-theme()
  node_modules/@angular/material/legacy-button/_button-theme.scss 168:3         color()
  node_modules/@angular/material/legacy-button/_button-theme.scss 214:7         @content
  node_modules/@angular/material/core/theming/_theming.scss 402:3               private-check-duplicate-theme-styles()
  node_modules/@angular/material/legacy-button/_button-theme.scss 208:3         theme()
  node_modules/@angular/material/legacy-core/theming/_all-theme.scss 45:5       @content
  node_modules/@angular/material/core/theming/_theming.scss 402:3               private-check-duplicate-theme-styles()
  node_modules/@angular/material/legacy-core/theming/_all-theme.scss 43:3       all-legacy-component-themes()
  projects/soe-angular/theme/index.scss 34:1                                    @import
  src/styles.scss 2:9                                                           root stylesheet

the button theme is the only one that can’t handle rgb function. Because of this implementation in the _button-theme-private.scss file:


@mixin _ripple-color($color) {
  --mat-mdc-button-persistent-ripple-color: #{$color};
  --mat-mdc-button-ripple-color: #{rgba($color, 0.1)};
}

Our workaround is to define extra css variables in our branding file like this:

:root {
--color-1: 10,10,10;
.....
....
--color-1-rgb: rgb(var(--color-1));
}

and change variable in palette defintions. Very Very ugly but it works 😃

Is the idea to wait for the design of a new theming system based on CSS vars? Or will there still be a fix for the legacy variant as well?

Ok. I just changed my themes definition to this

  $theme: (
    primary: $primary,
    accent: $accent,
    warn: $warn,
    is-dark: false,
    foreground: $mat-css-palette-foreground,
    background:  $mat-css-palette-background
  );

  $dark-theme: (
    primary: $primary,
    accent: $accent,
    warn: $warn,
    is-dark: true,
    foreground: $mat-css-palette-foreground-dark,
    background:  $mat-css-palette-background-dark
  );

and now i have only warning var(--palette-primary-500) is not a color. Falling back to "dark" tone and colors still don’t work 😦

Now it compiles without remove/merge logic, but with warning and still colors are not applied

var(--palette-primary-500) is not a color. Falling back to "dark" tone.

@material\theme\_theme-color.scss 67:5                                   tone()
@material\ripple\_ripple-theme.scss 535:5                                states-opacity()
node_modules\@angular\material\list\_interactive-list-theme.scss 31:18   private-interactive-list-item-state-colors()
node_modules\@angular\material\list\_list-theme.scss 20:5                @content
node_modules\@angular\material\core\mdc-helpers\_mdc-helpers.scss 192:5  @content
node_modules\@angular\material\core\mdc-helpers\_mdc-helpers.scss 232:3  disable-mdc-fallback-declarations()
node_modules\@angular\material\core\mdc-helpers\_mdc-helpers.scss 191:3  using-mdc-theme()
node_modules\@angular\material\list\_list-theme.scss 17:3                color()
node_modules\@angular\material\list\_list-theme.scss 74:7                @content
node_modules\@angular\material\core\theming\_theming.scss 402:3          private-check-duplicate-theme-styles()
node_modules\@angular\material\list\_list-theme.scss 68:3                theme()
node_modules\@angular\material\core\theming\_all-theme.scss 59:5         @content
node_modules\@angular\material\core\theming\_theming.scss 402:3          private-check-duplicate-theme-styles()
node_modules\@angular\material\core\theming\_all-theme.scss 44:3         all-component-themes()
projects\material-css-vars\src\lib\_main.scss 44:3                       init-mat-theme()
projects\material-css-vars\src\lib\_main.scss 72:3                       init-material-css-vars()
src\styles.scss 8:1                                                      root stylesheet

Ok. I just removed all map-merge and map-remove rows and got old error

./src/styles.scss - Error: Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: $color: rgb(var(--palette-primary-500)) is not a color.
   ╷
75 │   @return rgba(mdc-theme-color.prop-value($palette), 0.87);
   │           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   ╵
  node_modules\@angular\material\form-field\_form-field-native-select.scss 75:11              -get-focused-arrow-color()
  node_modules\@angular\material\form-field\_form-field-native-select.scss 110:20             @content
  node_modules\@angular\material\core\mdc-helpers\_mdc-helpers.scss 192:5                     @content
  node_modules\@angular\material\core\mdc-helpers\_mdc-helpers.scss 232:3                     disable-mdc-fallback-declarations()
  node_modules\@angular\material\core\mdc-helpers\_mdc-helpers.scss 191:3                     using-mdc-theme()
  node_modules\@angular\material\form-field\_form-field-native-select.scss 79:3               private-form-field-native-select-color()
  node_modules\@angular\material\form-field\_form-field-theme.scss 53:7                       @content
  node_modules\@angular\material\form-field\_mdc-text-field-theme-variable-refresh.scss 56:3  private-text-field-refresh-theme-variables()        
  node_modules\@angular\material\form-field\_form-field-theme.scss 46:5                       @content
  node_modules\@angular\material\core\mdc-helpers\_mdc-helpers.scss 192:5                     @content
  node_modules\@angular\material\core\mdc-helpers\_mdc-helpers.scss 232:3                     disable-mdc-fallback-declarations()
  node_modules\@angular\material\core\mdc-helpers\_mdc-helpers.scss 191:3                     using-mdc-theme()
  node_modules\@angular\material\form-field\_form-field-theme.scss 45:3                       color()
  node_modules\@angular\material\form-field\_form-field-theme.scss 140:7                      @content
  node_modules\@angular\material\core\theming\_theming.scss 402:3                             private-check-duplicate-theme-styles()
  node_modules\@angular\material\form-field\_form-field-theme.scss 134:3                      theme()
  node_modules\@angular\material\core\theming\_all-theme.scss 49:5                            @content
  node_modules\@angular\material\core\theming\_theming.scss 402:3                             private-check-duplicate-theme-styles()
  node_modules\@angular\material\core\theming\_all-theme.scss 44:3                            all-component-themes()
  projects\material-css-vars\src\lib\_main.scss 43:3                                          init-mat-theme()
  projects\material-css-vars\src\lib\_main.scss 70:3                                          init-material-css-vars()
  src\styles.scss 8:1                                                                         root stylesheet

Same here, would be nice if the error in “_progress-bar-theme.scss” could be changed to a warning or fixed.

It looks like this setup is working (still testing, but wanted to share already)

The “legacy” mixins aren’t using mdc and shouldn’t be affected by this bug. But, as @tkutcher mentioned, they’re also deprecated and being removed in v17

You are right, I’ve changed my comment a bit.

Same behaviour here with following styles.scss:

@use '@angular/material' as mat;
@use "sass:map";

// Include the core Angular Material styles
@include mat.core();

// Create a base theme without color.
// This will globally set the density and typography for all future color themes.
@include mat.all-component-themes((
  color: null,
  density: -2,
  typography: mat.define-typography-config(
    $font-family: theme('fontFamily.sans'),
  )
));

:root {
  --primary: #3f51b5;
  --primary-50: #fefeff;
  --primary-100: #c6cbeb;
  --primary-200: #9ca6dd;
  --primary-300: #6776ca;
  --primary-400: #5062c2;
  --primary-500: #3f51b5;
  --primary-600: #37479e;
  --primary-700: #2f3d88;
  --primary-800: #273371;
  --primary-900: #1f285a;
  --primary-A100: #f7f8fc;
  --primary-A200: #abb4e2;
  --primary-A400: #606fc7;
  --primary-A700: #4d5ec1;
  --on-primary: #ffffff;
  --on-primary-50: #000000;
  --on-primary-100: #000000;
  --on-primary-200: #000000;
  --on-primary-300: #000000;
  --on-primary-400: #ffffff;
  --on-primary-500: #ffffff;
  --on-primary-600: #ffffff;
  --on-primary-700: #ffffff;
  --on-primary-800: #ffffff;
  --on-primary-900: #ffffff;
  --on-primary-A100: #000000;
  --on-primary-A200: #000000;
  --on-primary-A400: #000000;
  --on-primary-A700: #ffffff;

  --accent: #e91e63;
  --accent-50: #ffffff;
  --accent-100: #facada;
  --accent-200: #f597b7;
  --accent-300: #ee568a;
  --accent-400: #ec3a76;
  --accent-500: #e91e63;
  --accent-600: #d41556;
  --accent-700: #b8124a;
  --accent-800: #9c0f3f;
  --accent-900: #800d34;
  --accent-A100: #ffffff;
  --accent-A200: #f7a9c4;
  --accent-A400: #ee4c83;
  --accent-A700: #eb3573;
  --on-accent: #000000;
  --on-accent-50: #000000;
  --on-accent-100: #000000;
  --on-accent-200: #000000;
  --on-accent-300: #000000;
  --on-accent-400: #000000;
  --on-accent-500: #000000;
  --on-accent-600: #ffffff;
  --on-accent-700: #ffffff;
  --on-accent-800: #ffffff;
  --on-accent-900: #ffffff;
  --on-accent-A100: #000000;
  --on-accent-A200: #000000;
  --on-accent-A400: #000000;
  --on-accent-A700: #000000;

  --warn: #e91e63;
  --warn-50: #ffffff;
  --warn-100: #facada;
  --warn-200: #f597b7;
  --warn-300: #ee568a;
  --warn-400: #ec3a76;
  --warn-500: #e91e63;
  --warn-600: #d41556;
  --warn-700: #b8124a;
  --warn-800: #9c0f3f;
  --warn-900: #800d34;
  --warn-A100: #ffffff;
  --warn-A200: #f7a9c4;
  --warn-A400: #ee4c83;
  --warn-A700: #eb3573;
  --on-warn: #000000;
  --on-warn-50: #000000;
  --on-warn-100: #000000;
  --on-warn-200: #000000;
  --on-warn-300: #000000;
  --on-warn-400: #000000;
  --on-warn-500: #000000;
  --on-warn-600: #ffffff;
  --on-warn-700: #ffffff;
  --on-warn-800: #ffffff;
  --on-warn-900: #ffffff;
  --on-warn-A100: #000000;
  --on-warn-A200: #000000;
  --on-warn-A400: #000000;
  --on-warn-A700: #000000;
}

// Generate Primary, Accent and Warn palettes
$palettes: ();
@each $name in (primary, accent, warn) {
  $palettes: map.merge($palettes, (#{$name}: (
    50: var(--#{$name}-50),
    100: var(--#{$name}-100),
    200: var(--#{$name}-200),
    300: var(--#{$name}-300),
    400: var(--#{$name}-400),
    500: var(--#{$name}-500),
    600: var(--#{$name}-600),
    700: var(--#{$name}-700),
    800: var(--#{$name}-800),
    900: var(--#{$name}-900),
    contrast: (
      50: var(--on-#{$name}-50),
      100: var(--on-#{$name}-100),
      200: var(--on-#{$name}-200),
      300: var(--on-#{$name}-300),
      400: var(--on-#{$name}-400),
      500: var(--on-#{$name}-500),
      600: var(--on-#{$name}-600),
      700: var(--on-#{$name}-700),
      800: var(--on-#{$name}-800),
      900: var(--on-#{$name}-900)
    ),
    default: var(--#{$name}),
    lighter: var(--#{$name}-100),
    darker: var(--#{$name}-700),
    text: var(--#{$name}),
    default-contrast: var(--on-#{$name}),
    lighter-contrast: var(--on-#{$name}-100),
    darker-contrast: var(--on-#{$name}-700)
  )));
}

// ...

// Generate Angular Material themes. Since we are using CSS Custom Properties,
// we don't have to generate a separate Angular Material theme for each color
// set. We can just create one light and one dark theme and then switch the
// CSS Custom Properties to dynamically switch the colors.
body.light,
body .light {
  $light-theme: mat.define-light-theme((color: ($palettes)));

  // Use all-component-colors to only generate the colors
  @include mat.all-component-colors($light-theme);
}

body.dark,
body .dark {
  $dark-theme: mat.define-dark-theme((color: ($palettes)));

  // Use all-component-colors to only generate the colors
  @include mat.all-component-colors($dark-theme);
}

// ...

When running ng serve i got some errors:


Initial Chunk Files | Names         |  Raw Size
vendor.js           | vendor        |   2.57 MB | 
polyfills.js        | polyfills     | 314.19 kB | 
styles.js           | styles        | 227.55 kB | 
main.js             | main          |  42.52 kB | 
runtime.js          | runtime       |   6.52 kB | 

                    | Initial Total |   3.15 MB

Build at: 2022-11-17T13:17:58.208Z - Hash: 9f56a71cc5f42a34 - Time: 10093ms

./examples/playground/src/styles.scss.webpack[javascript/auto]!=!./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[6].rules[0].oneOf[0].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[6].rules[0].oneOf[0].use[2]!./node_modules/resolve-url-loader/index.js??ruleSet[1].rules[6].rules[1].use[0]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[6].rules[1].use[1]!./examples/playground/src/styles.scss?ngGlobalStyle - Warning: Module Warning (from ./node_modules/sass-loader/dist/cjs.js):
Deprecation $weight: Passing a number without unit % (60) is deprecated.

To preserve current behavior: $weight * 1%

More info: https://sass-lang.com/d/function-units

@material/slider/_slider-theme.scss 77:5                                    @use
node_modules/@angular/material/slider/_slider-theme.scss 3:1                @use
node_modules/@angular/material/core/density/private/_all-density.scss 25:1  @forward
@angular/_index.scss 18:1                                                   @use
src/styles/core/_theming.scss 1:1                                           @use
src/styles.scss 1:1                                                         root stylesheet


./examples/playground/src/styles.scss.webpack[javascript/auto]!=!./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[6].rules[0].oneOf[0].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[6].rules[0].oneOf[0].use[2]!./node_modules/resolve-url-loader/index.js??ruleSet[1].rules[6].rules[1].use[0]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[6].rules[1].use[1]!./examples/playground/src/styles.scss?ngGlobalStyle - Warning: Module Warning (from ./node_modules/sass-loader/dist/cjs.js):
var(--accent) is not a color. Falling back to "dark" tone.

@material/theme/_theme-color.scss 67:5                                     tone()
@material/theme/_theme-color.scss 86:14                                    contrast-tone()
node_modules/@angular/material/core/mdc-helpers/_mdc-helpers.scss 126:10   using-mdc-theme()
node_modules/@angular/material/progress-bar/_progress-bar-theme.scss 26:3  color()
node_modules/@angular/material/progress-bar/_progress-bar-theme.scss 53:7  @content
node_modules/@angular/material/core/theming/_theming.scss 402:3            private-check-duplicate-theme-styles()
node_modules/@angular/material/progress-bar/_progress-bar-theme.scss 47:3  theme()
node_modules/@angular/material/core/theming/_all-theme.scss 47:5           @content
node_modules/@angular/material/core/theming/_theming.scss 402:3            private-check-duplicate-theme-styles()
node_modules/@angular/material/core/theming/_all-theme.scss 44:3           all-component-themes()
node_modules/@angular/material/core/color/_all-color.scss 15:3             all-component-colors()
src/styles/core/_theming.scss 171:3                                        @use
src/styles.scss 1:1                                                        root stylesheet


./examples/playground/src/styles.scss.webpack[javascript/auto]!=!./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[6].rules[0].oneOf[0].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[6].rules[0].oneOf[0].use[2]!./node_modules/resolve-url-loader/index.js??ruleSet[1].rules[6].rules[1].use[0]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[6].rules[1].use[1]!./examples/playground/src/styles.scss?ngGlobalStyle - Warning: Module Warning (from ./node_modules/sass-loader/dist/cjs.js):
var(--accent) is not a color. Falling back to "dark" tone.

@material/theme/_theme-color.scss 67:5                                    tone()
@material/theme/_theme-color.scss 86:14                                   contrast-tone()
node_modules/@angular/material/core/mdc-helpers/_mdc-helpers.scss 126:10  using-mdc-theme()
node_modules/@angular/material/card/_card-theme.scss 16:3                 color()
node_modules/@angular/material/card/_card-theme.scss 70:7                 @content
node_modules/@angular/material/core/theming/_theming.scss 402:3           private-check-duplicate-theme-styles()
node_modules/@angular/material/card/_card-theme.scss 64:3                 theme()
node_modules/@angular/material/core/theming/_all-theme.scss 46:5          @content
node_modules/@angular/material/core/theming/_theming.scss 402:3           private-check-duplicate-theme-styles()
node_modules/@angular/material/core/theming/_all-theme.scss 44:3          all-component-themes()
node_modules/@angular/material/core/color/_all-color.scss 15:3            all-component-colors()
src/styles/core/_theming.scss 171:3                                       @use
src/styles.scss 1:1                                                       root stylesheet


./examples/playground/src/styles.scss.webpack[javascript/auto]!=!./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[6].rules[0].oneOf[0].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[6].rules[0].oneOf[0].use[2]!./node_modules/resolve-url-loader/index.js??ruleSet[1].rules[6].rules[1].use[0]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[6].rules[1].use[1]!./examples/playground/src/styles.scss?ngGlobalStyle - Warning: Module Warning (from ./node_modules/sass-loader/dist/cjs.js):
var(--accent) is not a color. Falling back to "dark" tone.

@material/theme/_theme-color.scss 67:5                                    tone()
@material/theme/_theme-color.scss 86:14                                   contrast-tone()
node_modules/@angular/material/core/mdc-helpers/_mdc-helpers.scss 126:10  using-mdc-theme()
node_modules/@angular/material/core/option/_optgroup-theme.scss 10:3      color()
node_modules/@angular/material/core/_core-theme.scss 16:3                 color()
node_modules/@angular/material/core/_core-theme.scss 83:7                 @content
node_modules/@angular/material/core/theming/_theming.scss 402:3           private-check-duplicate-theme-styles()
node_modules/@angular/material/core/_core-theme.scss 77:3                 theme()
node_modules/@angular/material/core/theming/_all-theme.scss 45:5          @content
node_modules/@angular/material/core/theming/_theming.scss 402:3           private-check-duplicate-theme-styles()
node_modules/@angular/material/core/theming/_all-theme.scss 44:3          all-component-themes()
node_modules/@angular/material/core/color/_all-color.scss 15:3            all-component-colors()
src/styles/core/_theming.scss 171:3                                       @use
src/styles.scss 1:1                                                       root stylesheet


./examples/playground/src/styles.scss.webpack[javascript/auto]!=!./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[6].rules[0].oneOf[0].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[6].rules[0].oneOf[0].use[2]!./node_modules/resolve-url-loader/index.js??ruleSet[1].rules[6].rules[1].use[0]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[6].rules[1].use[1]!./examples/playground/src/styles.scss?ngGlobalStyle - Warning: Module Warning (from ./node_modules/sass-loader/dist/cjs.js):
var(--accent) is not a color. Falling back to "dark" tone.

@material/theme/_theme-color.scss 67:5                                    tone()
@material/theme/_theme-color.scss 86:14                                   contrast-tone()
node_modules/@angular/material/core/mdc-helpers/_mdc-helpers.scss 126:10  using-mdc-theme()
node_modules/@angular/material/core/option/_option-theme.scss 14:3        color()
node_modules/@angular/material/core/_core-theme.scss 15:3                 color()
node_modules/@angular/material/core/_core-theme.scss 83:7                 @content
node_modules/@angular/material/core/theming/_theming.scss 402:3           private-check-duplicate-theme-styles()
node_modules/@angular/material/core/_core-theme.scss 77:3                 theme()
node_modules/@angular/material/core/theming/_all-theme.scss 45:5          @content
node_modules/@angular/material/core/theming/_theming.scss 402:3           private-check-duplicate-theme-styles()
node_modules/@angular/material/core/theming/_all-theme.scss 44:3          all-component-themes()
node_modules/@angular/material/core/color/_all-color.scss 15:3            all-component-colors()
src/styles/core/_theming.scss 171:3                                       @use
src/styles.scss 1:1                                                       root stylesheet


./examples/playground/src/styles.scss.webpack[javascript/auto]!=!./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[6].rules[0].oneOf[0].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[6].rules[0].oneOf[0].use[2]!./node_modules/resolve-url-loader/index.js??ruleSet[1].rules[6].rules[1].use[0]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[6].rules[1].use[1]!./examples/playground/src/styles.scss?ngGlobalStyle - Warning: Module Warning (from ./node_modules/sass-loader/dist/cjs.js):
var(--primary) is not a color. Falling back to "dark" tone.

@material/theme/_theme-color.scss 67:5                                     tone()
@material/theme/_theme-color.scss 86:14                                    contrast-tone()
node_modules/@angular/material/core/mdc-helpers/_mdc-helpers.scss 123:10   using-mdc-theme()
node_modules/@angular/material/progress-bar/_progress-bar-theme.scss 26:3  color()
node_modules/@angular/material/progress-bar/_progress-bar-theme.scss 53:7  @content
node_modules/@angular/material/core/theming/_theming.scss 402:3            private-check-duplicate-theme-styles()
node_modules/@angular/material/progress-bar/_progress-bar-theme.scss 47:3  theme()
node_modules/@angular/material/core/theming/_all-theme.scss 47:5           @content
node_modules/@angular/material/core/theming/_theming.scss 402:3            private-check-duplicate-theme-styles()
node_modules/@angular/material/core/theming/_all-theme.scss 44:3           all-component-themes()
node_modules/@angular/material/core/color/_all-color.scss 15:3             all-component-colors()
src/styles/core/_theming.scss 171:3                                        @use
src/styles.scss 1:1                                                       root stylesheet


./examples/playground/src/styles.scss.webpack[javascript/auto]!=!./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[6].rules[0].oneOf[0].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[6].rules[0].oneOf[0].use[2]!./node_modules/resolve-url-loader/index.js??ruleSet[1].rules[6].rules[1].use[0]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[6].rules[1].use[1]!./examples/playground/src/styles.scss?ngGlobalStyle - Warning: Module Warning (from ./node_modules/sass-loader/dist/cjs.js):
var(--primary) is not a color. Falling back to "dark" tone.

@material/theme/_theme-color.scss 67:5                                    tone()
@material/theme/_theme-color.scss 86:14                                   contrast-tone()
node_modules/@angular/material/core/mdc-helpers/_mdc-helpers.scss 123:10  using-mdc-theme()
node_modules/@angular/material/card/_card-theme.scss 16:3                 color()
node_modules/@angular/material/card/_card-theme.scss 70:7                 @content
node_modules/@angular/material/core/theming/_theming.scss 402:3           private-check-duplicate-theme-styles()
node_modules/@angular/material/card/_card-theme.scss 64:3                 theme()
node_modules/@angular/material/core/theming/_all-theme.scss 46:5          @content
node_modules/@angular/material/core/theming/_theming.scss 402:3           private-check-duplicate-theme-styles()
node_modules/@angular/material/core/theming/_all-theme.scss 44:3          all-component-themes()
node_modules/@angular/material/core/color/_all-color.scss 15:3            all-component-colors()
src/styles/core/_theming.scss 171:3                                       @use
src/styles.scss 1:1                                                       root stylesheet


./examples/playground/src/styles.scss.webpack[javascript/auto]!=!./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[6].rules[0].oneOf[0].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[6].rules[0].oneOf[0].use[2]!./node_modules/resolve-url-loader/index.js??ruleSet[1].rules[6].rules[1].use[0]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[6].rules[1].use[1]!./examples/playground/src/styles.scss?ngGlobalStyle - Warning: Module Warning (from ./node_modules/sass-loader/dist/cjs.js):
var(--primary) is not a color. Falling back to "dark" tone.

@material/theme/_theme-color.scss 67:5                                    tone()
@material/theme/_theme-color.scss 86:14                                   contrast-tone()
node_modules/@angular/material/core/mdc-helpers/_mdc-helpers.scss 123:10  using-mdc-theme()
node_modules/@angular/material/core/option/_optgroup-theme.scss 10:3      color()
node_modules/@angular/material/core/_core-theme.scss 16:3                 color()
node_modules/@angular/material/core/_core-theme.scss 83:7                 @content
node_modules/@angular/material/core/theming/_theming.scss 402:3           private-check-duplicate-theme-styles()
node_modules/@angular/material/core/_core-theme.scss 77:3                 theme()
node_modules/@angular/material/core/theming/_all-theme.scss 45:5          @content
node_modules/@angular/material/core/theming/_theming.scss 402:3           private-check-duplicate-theme-styles()
node_modules/@angular/material/core/theming/_all-theme.scss 44:3          all-component-themes()
node_modules/@angular/material/core/color/_all-color.scss 15:3            all-component-colors()
src/styles/core/_theming.scss 171:3                                       @use
src/styles.scss 1:1                                                       root stylesheet


./examples/playground/src/styles.scss.webpack[javascript/auto]!=!./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[6].rules[0].oneOf[0].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[6].rules[0].oneOf[0].use[2]!./node_modules/resolve-url-loader/index.js??ruleSet[1].rules[6].rules[1].use[0]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[6].rules[1].use[1]!./examples/playground/src/styles.scss?ngGlobalStyle - Warning: Module Warning (from ./node_modules/sass-loader/dist/cjs.js):
var(--primary) is not a color. Falling back to "dark" tone.

@material/theme/_theme-color.scss 67:5                                    tone()
@material/theme/_theme-color.scss 86:14                                   contrast-tone()
node_modules/@angular/material/core/mdc-helpers/_mdc-helpers.scss 123:10  using-mdc-theme()
node_modules/@angular/material/core/option/_option-theme.scss 14:3        color()
node_modules/@angular/material/core/_core-theme.scss 15:3                 color()
node_modules/@angular/material/core/_core-theme.scss 83:7                 @content
node_modules/@angular/material/core/theming/_theming.scss 402:3           private-check-duplicate-theme-styles()
node_modules/@angular/material/core/_core-theme.scss 77:3                 theme()
node_modules/@angular/material/core/theming/_all-theme.scss 45:5          @content
node_modules/@angular/material/core/theming/_theming.scss 402:3           private-check-duplicate-theme-styles()
node_modules/@angular/material/core/theming/_all-theme.scss 44:3          all-component-themes()
node_modules/@angular/material/core/color/_all-color.scss 15:3            all-component-colors()
src/styles/core/_theming.scss 171:3                                       @use
src/styles.scss 1:1                                                       root stylesheet


./examples/playground/src/styles.scss.webpack[javascript/auto]!=!./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[6].rules[0].oneOf[0].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[6].rules[0].oneOf[0].use[2]!./node_modules/resolve-url-loader/index.js??ruleSet[1].rules[6].rules[1].use[0]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[6].rules[1].use[1]!./examples/playground/src/styles.scss?ngGlobalStyle - Warning: Module Warning (from ./node_modules/sass-loader/dist/cjs.js):
var(--warn) is not a color. Falling back to "dark" tone.

@material/theme/_theme-color.scss 67:5                                     tone()
@material/theme/_theme-color.scss 86:14                                    contrast-tone()
node_modules/@angular/material/core/mdc-helpers/_mdc-helpers.scss 133:10   using-mdc-theme()
node_modules/@angular/material/progress-bar/_progress-bar-theme.scss 26:3  color()
node_modules/@angular/material/progress-bar/_progress-bar-theme.scss 53:7  @content
node_modules/@angular/material/core/theming/_theming.scss 402:3            private-check-duplicate-theme-styles()
node_modules/@angular/material/progress-bar/_progress-bar-theme.scss 47:3  theme()
node_modules/@angular/material/core/theming/_all-theme.scss 47:5           @content
node_modules/@angular/material/core/theming/_theming.scss 402:3            private-check-duplicate-theme-styles()
node_modules/@angular/material/core/theming/_all-theme.scss 44:3           all-component-themes()
node_modules/@angular/material/core/color/_all-color.scss 15:3             all-component-colors()
src/styles/core/_theming.scss 171:3                                        @use
src/styles.scss 1:1                                                       root stylesheet


./examples/playground/src/styles.scss.webpack[javascript/auto]!=!./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[6].rules[0].oneOf[0].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[6].rules[0].oneOf[0].use[2]!./node_modules/resolve-url-loader/index.js??ruleSet[1].rules[6].rules[1].use[0]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[6].rules[1].use[1]!./examples/playground/src/styles.scss?ngGlobalStyle - Warning: Module Warning (from ./node_modules/sass-loader/dist/cjs.js):
var(--warn) is not a color. Falling back to "dark" tone.

@material/theme/_theme-color.scss 67:5                                    tone()
@material/theme/_theme-color.scss 86:14                                   contrast-tone()
node_modules/@angular/material/core/mdc-helpers/_mdc-helpers.scss 133:10  using-mdc-theme()
node_modules/@angular/material/card/_card-theme.scss 16:3                 color()
node_modules/@angular/material/card/_card-theme.scss 70:7                 @content
node_modules/@angular/material/core/theming/_theming.scss 402:3           private-check-duplicate-theme-styles()
node_modules/@angular/material/card/_card-theme.scss 64:3                 theme()
node_modules/@angular/material/core/theming/_all-theme.scss 46:5          @content
node_modules/@angular/material/core/theming/_theming.scss 402:3           private-check-duplicate-theme-styles()
node_modules/@angular/material/core/theming/_all-theme.scss 44:3          all-component-themes()
node_modules/@angular/material/core/color/_all-color.scss 15:3            all-component-colors()
src/styles/core/_theming.scss 171:3                                       @use
src/styles.scss 1:1                                                       root stylesheet


./examples/playground/src/styles.scss.webpack[javascript/auto]!=!./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[6].rules[0].oneOf[0].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[6].rules[0].oneOf[0].use[2]!./node_modules/resolve-url-loader/index.js??ruleSet[1].rules[6].rules[1].use[0]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[6].rules[1].use[1]!./examples/playground/src/styles.scss?ngGlobalStyle - Warning: Module Warning (from ./node_modules/sass-loader/dist/cjs.js):
var(--warn) is not a color. Falling back to "dark" tone.

@material/theme/_theme-color.scss 67:5                                    tone()
@material/theme/_theme-color.scss 86:14                                   contrast-tone()
node_modules/@angular/material/core/mdc-helpers/_mdc-helpers.scss 133:10  using-mdc-theme()
node_modules/@angular/material/core/option/_optgroup-theme.scss 10:3      color()
node_modules/@angular/material/core/_core-theme.scss 16:3                 color()
node_modules/@angular/material/core/_core-theme.scss 83:7                 @content
node_modules/@angular/material/core/theming/_theming.scss 402:3           private-check-duplicate-theme-styles()
node_modules/@angular/material/core/_core-theme.scss 77:3                 theme()
node_modules/@angular/material/core/theming/_all-theme.scss 45:5          @content
node_modules/@angular/material/core/theming/_theming.scss 402:3           private-check-duplicate-theme-styles()
node_modules/@angular/material/core/theming/_all-theme.scss 44:3          all-component-themes()
node_modules/@angular/material/core/color/_all-color.scss 15:3            all-component-colors()
src/styles/core/_theming.scss 171:3                                       @use
src/styles.scss 1:1                                                       root stylesheet


./examples/playground/src/styles.scss.webpack[javascript/auto]!=!./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[6].rules[0].oneOf[0].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[6].rules[0].oneOf[0].use[2]!./node_modules/resolve-url-loader/index.js??ruleSet[1].rules[6].rules[1].use[0]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[6].rules[1].use[1]!./examples/playground/src/styles.scss?ngGlobalStyle - Warning: Module Warning (from ./node_modules/sass-loader/dist/cjs.js):
var(--warn) is not a color. Falling back to "dark" tone.

@material/theme/_theme-color.scss 67:5                                    tone()
@material/theme/_theme-color.scss 86:14                                   contrast-tone()
node_modules/@angular/material/core/mdc-helpers/_mdc-helpers.scss 133:10  using-mdc-theme()
node_modules/@angular/material/core/option/_option-theme.scss 14:3        color()
node_modules/@angular/material/core/_core-theme.scss 15:3                 color()
node_modules/@angular/material/core/_core-theme.scss 83:7                 @content
node_modules/@angular/material/core/theming/_theming.scss 402:3           private-check-duplicate-theme-styles()
node_modules/@angular/material/core/_core-theme.scss 77:3                 theme()
node_modules/@angular/material/core/theming/_all-theme.scss 45:5          @content
node_modules/@angular/material/core/theming/_theming.scss 402:3           private-check-duplicate-theme-styles()
node_modules/@angular/material/core/theming/_all-theme.scss 44:3          all-component-themes()
node_modules/@angular/material/core/color/_all-color.scss 15:3            all-component-colors()
src/styles/core/_theming.scss 171:3                                       @use
src/styles.scss 1:1                                                       root stylesheet




./examples/playground/src/styles.scss - Error: Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: $color: var(--primary) is not a color.
   ╷
16 │     track-color: color.adjust(mdc-theme-color.prop-value($color), $alpha: -0.75),
   │                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   ╵
  node_modules/@angular/material/progress-bar/_progress-bar-theme.scss 16:18  -palette-styles()
  node_modules/@angular/material/progress-bar/_progress-bar-theme.scss 28:7   @content
  node_modules/@angular/material/core/mdc-helpers/_mdc-helpers.scss 176:5     @content
  node_modules/@angular/material/core/mdc-helpers/_mdc-helpers.scss 216:3     disable-mdc-fallback-declarations()
  node_modules/@angular/material/core/mdc-helpers/_mdc-helpers.scss 175:3     using-mdc-theme()
  node_modules/@angular/material/progress-bar/_progress-bar-theme.scss 26:3   color()
  node_modules/@angular/material/progress-bar/_progress-bar-theme.scss 53:7   @content
  node_modules/@angular/material/core/theming/_theming.scss 402:3             private-check-duplicate-theme-styles()
  node_modules/@angular/material/progress-bar/_progress-bar-theme.scss 47:3   theme()
  node_modules/@angular/material/core/theming/_all-theme.scss 47:5            @content
  node_modules/@angular/material/core/theming/_theming.scss 402:3             private-check-duplicate-theme-styles()
  node_modules/@angular/material/core/theming/_all-theme.scss 44:3            all-component-themes()
  node_modules/@angular/material/core/color/_all-color.scss 15:3              all-component-colors()
  src/styles/core/_theming.scss 171:3                                         @use
  src/styles.scss 1:1                                                         root stylesheet

./examples/playground/src/styles.scss?ngGlobalStyle - Error: Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
HookWebpackError: Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: $color: var(--primary) is not a color.
   ╷
16 │     track-color: color.adjust(mdc-theme-color.prop-value($color), $alpha: -0.75),
   │                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   ╵
  node_modules/@angular/material/progress-bar/_progress-bar-theme.scss 16:18  -palette-styles()
  node_modules/@angular/material/progress-bar/_progress-bar-theme.scss 28:7   @content
  node_modules/@angular/material/core/mdc-helpers/_mdc-helpers.scss 176:5     @content
  node_modules/@angular/material/core/mdc-helpers/_mdc-helpers.scss 216:3     disable-mdc-fallback-declarations()
  node_modules/@angular/material/core/mdc-helpers/_mdc-helpers.scss 175:3     using-mdc-theme()
  node_modules/@angular/material/progress-bar/_progress-bar-theme.scss 26:3   color()
  node_modules/@angular/material/progress-bar/_progress-bar-theme.scss 53:7   @content
  node_modules/@angular/material/core/theming/_theming.scss 402:3             private-check-duplicate-theme-styles()
  node_modules/@angular/material/progress-bar/_progress-bar-theme.scss 47:3   theme()
  node_modules/@angular/material/core/theming/_all-theme.scss 47:5            @content
  node_modules/@angular/material/core/theming/_theming.scss 402:3             private-check-duplicate-theme-styles()
  node_modules/@angular/material/core/theming/_all-theme.scss 44:3            all-component-themes()
  node_modules/@angular/material/core/color/_all-color.scss 15:3              all-component-colors()
  src/styles/core/_theming.scss 171:3                                         @use
  src/styles.scss 1:1                                                         root stylesheet



** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **


✖ Failed to compile.

I can perform a simpler test later to simplify the example.