Skip to content

Commit 4b13555

Browse files
crisbetotinayuangao
authored andcommitted
fix(table): use solid color for sorting arrow (#11533)
Currently we use an rgba color for the table's sorting arrow which ends up looking weird, because the arrow is made up of multiple stacked elements. These changes add some logic that convert the arrow's color into a solid one so the individual pieces can blend into each other. Fixes #11340.
1 parent 1ff9cf0 commit 4b13555

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/lib/sort/_sort-theme.scss

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
1-
// Empty mixins to be consistent with all other components.
2-
@mixin mat-sort-theme($theme) { }
1+
@mixin mat-sort-theme($theme) {
2+
$background: map-get($theme, background);
3+
$foreground: map-get($theme, foreground);
4+
5+
.mat-sort-header-arrow {
6+
// Because the arrow is made up of multiple elements that are stacked on top of each other,
7+
// we can't use the semi-trasparent color from the theme directly. We convert it into a solid
8+
// color by taking the opacity from the rgba value and using the value to determine the
9+
// percentage of the background to put into foreground when mixing the colors together.
10+
$table-background: mat-color($background, 'card');
11+
$text-color: mat-color($foreground, secondary-text);
12+
$text-opacity: opacity($text-color);
13+
color: mix($table-background, rgba($text-color, 1), (1 - $text-opacity) * 100%);
14+
}
15+
}
316

417
@mixin mat-sort-typography($config) { }

0 commit comments

Comments
 (0)