Skip to content

Commit 512433b

Browse files
authored
fix(material/badge): remove badge opacity color mix (#31213)
* fix(material/badge): remove badge opacity color mix * refactor: lint * refactor: lint
1 parent d681762 commit 512433b

File tree

1 file changed

+2
-17
lines changed

1 file changed

+2
-17
lines changed

src/material/badge/_m2-badge.scss

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
@use 'sass:meta';
21
@use 'sass:map';
32
@use 'sass:math';
4-
@use 'sass:color';
53
@use '../core/theming/inspection';
64

75
$_default-size: 22px;
@@ -42,22 +40,9 @@ $_large-size: $_default-size + 6px;
4240
// Tokens that can be configured through Angular Material's color theming API.
4341
@function get-color-tokens($theme) {
4442
$primary-color-tokens: private-get-color-palette-color-tokens($theme, primary);
45-
$app-background: inspection.get-theme-color($theme, background, background);
46-
$disabled-background: inspection.get-theme-color($theme, foreground, disabled-button);
47-
48-
// The disabled color usually has some kind of opacity, but because the badge is overlayed
49-
// on top of something else, it won't look good if it's opaque. If it is a color *type*,
50-
// we convert it into a solid color by taking the opacity from the rgba value and using
51-
// the value to determine the percentage of the background to put into foreground when
52-
// mixing the colors together.
53-
@if (meta.type-of($disabled-background) == color and meta.type-of($app-background) == color) {
54-
$badge-opacity: color.opacity($disabled-background);
55-
$disabled-background: color.mix($app-background,
56-
rgba($disabled-background, 1), (1 - $badge-opacity) * 100%);
57-
}
58-
5943
@return map.merge($primary-color-tokens, (
60-
badge-disabled-state-background-color: $disabled-background,
44+
badge-disabled-state-background-color:
45+
inspection.get-theme-color($theme, foreground, disabled-button),
6146
badge-disabled-state-text-color: inspection.get-theme-color($theme, foreground, disabled-text),
6247
));
6348
}

0 commit comments

Comments
 (0)