Angular theme: how to use Material theme color within a custom component style?

Viewed 116

Despite hours spent looking for this info, I don't know how to use the Material pre-built theme colors I choose from Angular Material, with my own components.

I was expecting something like that, my-component.component.scss

a {
  color: $primary-color;
}

a .active {
  color: $active-link
}

However, it seems it does not work that way as I cannot find any list of "colors" to be used.

The closer thing I found was to do the following:

@use '~@angular/material' as mat;
$my-palette: mat.define-palette(mat.$indigo-palette);

a {
  color: mat.get-color-from-palette($my-palette, '100-contrast');
}

The catch is I don't want to specify a palette, but I would like to use the default one. Plus I doubt this is the best way to import theme colors...

Any help with dummy example would be really appreciated!

0 Answers
Related