Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 2 additions & 17 deletions src/material/badge/_m2-badge.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
@use 'sass:meta';
@use 'sass:map';
@use 'sass:math';
@use 'sass:color';
@use '../core/theming/inspection';

$_default-size: 22px;
Expand Down Expand Up @@ -42,22 +40,9 @@ $_large-size: $_default-size + 6px;
// Tokens that can be configured through Angular Material's color theming API.
@function get-color-tokens($theme) {
$primary-color-tokens: private-get-color-palette-color-tokens($theme, primary);
$app-background: inspection.get-theme-color($theme, background, background);
$disabled-background: inspection.get-theme-color($theme, foreground, disabled-button);

// The disabled color usually has some kind of opacity, but because the badge is overlayed
// on top of something else, it won't look good if it's opaque. If it is a color *type*,
// we convert it into a solid color by taking the opacity from the rgba value and using
// the value to determine the percentage of the background to put into foreground when
// mixing the colors together.
@if (meta.type-of($disabled-background) == color and meta.type-of($app-background) == color) {
$badge-opacity: color.opacity($disabled-background);
$disabled-background: color.mix($app-background,
rgba($disabled-background, 1), (1 - $badge-opacity) * 100%);
}

@return map.merge($primary-color-tokens, (
badge-disabled-state-background-color: $disabled-background,
badge-disabled-state-background-color:
inspection.get-theme-color($theme, foreground, disabled-button),
badge-disabled-state-text-color: inspection.get-theme-color($theme, foreground, disabled-text),
));
}
Expand Down
Loading