Skip to content
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

fix(material/progress-bar): do not adjust color if it is not defined as a color #26017

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/material/progress-bar/_progress-bar-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@
@use '@material/theme/theme-color' as mdc-theme-color;
@use '@material/linear-progress/linear-progress-theme' as mdc-linear-progress-theme;
@use 'sass:color';
@use 'sass:meta';

@function _get-buffer-color($color) {
@if (meta.type-of($color) == 'color') {
@return color.adjust($color, $alpha: -0.75);
}
@return $color;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any CSS expert help me figure out how to change the alpha channel of this color keeping in mind that it can be any type of color (HSL, RGB, RGBA, hex, etc)?

}

@mixin _palette-styles($color) {
// We can't set the `track-color` using `theme`, because it isn't possible for it to use a CSS
Expand All @@ -13,7 +20,7 @@
// writing, their buffer color is hardcoded to #e6e6e6 which both doesn't account for theming
// and doesn't match the Material design spec. For now we approximate the buffer background by
// applying an opacity to the color of the bar.
track-color: color.adjust(mdc-theme-color.prop-value($color), $alpha: -0.75),
track-color: _get-buffer-color(mdc-theme-color.prop-value($color)),
));

@include mdc-linear-progress-theme.theme((
Expand Down