components icon indicating copy to clipboard operation
components copied to clipboard

Mat.Get-Color-From-Palette($palette, $hue) -- $hue number cannot be string

Open benclarkdev opened this issue 3 years ago • 0 comments
trafficstars

Documentation Feedback

In this section, the mat.get-color-from-palette($palette, $hue...) is shown with a numerical value in quotes, unlike the 'Theming Your Own Components' page, which shows it as a number.

As you can see in this stackblitz, it doesn't appear you can actually use the string '500', you have to use the number 500. I found this in angular 12, though it seems to extend to 13 and 14.

https://stackblitz.com/edit/angular-ivy-51elax?file=src/app/app.component.html

// this doesn't work, but is shown on theming
.my-custom-style {
       background: mat.get-color-from-palette($my-palette, '500');

// this works, shown on the theming components page
.my-custom-style {
       background: mat.get-color-from-palette($my-palette, 500);

Affected documentation page

https://v12.material.angular.io/guide/theming#reading-hues-from-palettes

benclarkdev avatar Sep 07 '22 21:09 benclarkdev