`mat.get-color-from-palette` not working for contrast values
See original GitHub issueReproduction
https://stackblitz.com/edit/angular-ivy-3vbd2j?file=src/styles.scss
color
value for .custom-element
is not set by mat.get-color-from-palette($my-primary, 700-contrast);
background-color
is set correctly with mat.get-color-from-palette($my-primary, 700);
Expected Behavior
According to documentation : we can get the constrast of a hue by adding -contrast
to the hue number mat.get-color-from-palette($my-primary, 700-contrast);
Actual Behavior
The value of the color when adding -constrast
is empty
Environment
- Angular: 12.1.3
- CDK/Material: 12.1.3
- Browser(s): Chrome 92.0.4515.107
- Operating System: Windows
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Get Palette Contrast Hue Based on Current Theme
The '*-contrast' mapped colors are pulled from the contrast sub-palette using the same hue value keys. When you call mat-color() without a ...
Read more >Using Angular get-color-from-palette to Retrieve Color Values
Scenario. We have defined our SASS Angular Material Accent color palette like this. $theme-accent: mat.define-palette(mat.
Read more >get-color-from-palette-contrast-issue-fork1 - StackBlitz
Starter project for Angular apps that exports to the Angular CLI.
Read more >Theming your own components - Angular Material
To read color values from a theme, you can use the get-color-config Sass function. This function returns a Sass map containing the theme's...
Read more >Angular Material Theming System - Complete Guide
We will implement lazy loading for dark theme, so that it only loads when needed. ... &.mat-primary { #{$property}: theming.get-color-from-palette($primary, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
ok, weird. I guess that Sass preserves the type of the keys for the ones that are actual numbers. So you should have quotes around
700-contrast
, but not around700
. I’ll tweak the fix in #23237 to handle both cases.This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.