You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wanted to use CSS variables to change my Angular Material theme at runtime.
When implementing this I came across some issues where once CSS variables are used inside a theme, some Material styles were broken.
This even happens when the variable is never initialised and only the fallback value is used.
There are various places where problems occur, I have now just picked one example for the StackBlitz reproduction:
The accent contrast color falls back to black for buttons.
In the src/theme.scss file I added a variable for the A200 color of my theme palette.
This breaks the buttons color as the wrong contrast color is used for the text.
Steps to reproduce:
Look at the compilation: The button has black text
Comment out the A200: var(...) line
Remove the comment from the following A200: map-get(...) line
Look at the compilation: The button has white text (as it should have)
Expected Behavior
The button should use the correct contrast color and behave the same as if no CSS variable was used.
Actual Behavior
The buttons uses a wrong accent color.
Environment
Angular: 16.02.1
CDK/Material: 16.02.1
Browser(s): Chrome
Operating System (e.g. Windows, macOS, Ubuntu): macOS
The text was updated successfully, but these errors were encountered:
Description
I wanted to use CSS variables to change my Angular Material theme at runtime.
When implementing this I came across some issues where once CSS variables are used inside a theme, some Material styles were broken.
This even happens when the variable is never initialised and only the fallback value is used.
There are various places where problems occur, I have now just picked one example for the StackBlitz reproduction:
The accent contrast color falls back to black for buttons.
Reproduction
StackBlitz link: https://stackblitz.com/edit/stackblitz-starters-fu4s5b?file=src%2Ftheme.scss
In the
src/theme.scss
file I added a variable for theA200
color of my theme palette.This breaks the buttons color as the wrong contrast color is used for the text.
Steps to reproduce:
A200: var(...)
lineA200: map-get(...)
lineExpected Behavior
The button should use the correct contrast color and behave the same as if no CSS variable was used.
Actual Behavior
The buttons uses a wrong accent color.
Environment
The text was updated successfully, but these errors were encountered: