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

Image by Greg Montani from Pixabay


$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.




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