Using Angular get-color-from-palette to Retrieve Color Values


We have defined our SASS Angular Material Accent color palette like this.

$theme-accent: mat.define-palette(mat.$cyan-palette);

And now we wish to retrieve a text color and background color from it using the default key (500).


html,body {height: 100%;background-color: mat.get-color-from-palette($theme-accent, default);color: mat.get-color-from-palette($theme-accent, default-contrast);}

For the background-color we use the default key, and for the text color we use the default-contrast key.


Use this playground to experiment with the Angular SASS Theming API.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ole Ersoy

Ole Ersoy

Founder of Firefly Semantics Corporation