-
Notifications
You must be signed in to change notification settings - Fork 6.8k
fix: errors when building theme using CSS variables #15140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
@import './all-theme'; | ||
|
||
// Recursively replaces all of the values inside a Sass map with a different value. | ||
@function replace-all-values($palette, $replacement) { | ||
$output: (); | ||
|
||
@each $key, $value in $palette { | ||
@if (type-of($value) == 'map') { | ||
$output: map-merge(($key: replace-all-values($value, $replacement)), $output); | ||
} | ||
@else { | ||
$output: map-merge(($key: $replacement), $output); | ||
} | ||
} | ||
|
||
@return $output; | ||
} | ||
|
||
// Theme used to test that our themes would compile if the colors were specified as CSS variables. | ||
._demo-css-variables-theme { | ||
$palette: mat-palette($mat-blue-grey); | ||
$theme: mat-dark-theme($palette, $palette, $palette); | ||
@include angular-material-theme(replace-all-values($theme, var(--test-var))); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm curious how things would actually look with the changes you've made, could we make a similar function that stores off the current values in the map (e.g. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should be able to get it to work, but I'd rather get this in first so we don't continue introducing new failures. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suppose it doesn't make things any worse for users |
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a comment along the lines:
(similar elsewhere)