How to theme angular material with css variables?
Is it possible to pass --blue-1: #228be6 variable to be used as $ng-io-accent?
@use '@angular/material' as mat;
$ng-io-primary: mat.define-palette(mat.$blue-palette, 700, 600, 800);
$ng-io-accent: mat.define-palette(mat.$red-palette, 700, 600, 800);
$ng-io-warn: mat.define-palette(mat.$red-palette);
$ng-io-theme: mat.define-light-theme($ng-io-primary, $ng-io-accent, $ng-io-warn);
@include mat.all-component-themes($ng-io-theme);
@include app-theme.theme($ng-io-theme);
I have tried those but they not work. I got compile error.
$ng-io-accent: mat.define-palette('--blue-1', 700, 600, 800);
$ng-io-accent: mat.define-palette('blue', 700, 600, 800);
$ng-io-accent: '--blue-1';
$ng-io-accent: mat.define-palette(var(--blue-1), 700, 600, 800);is the correct syntax. If you put your css variable's definition inside the:rootselector it should work