-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(button-toggle): use solid border color
Usually the theme divider color is rgba, which means that it can look differently, depending on the color behind it. As a result, the border of a selected button toggle is different from a deselected one, because its background color is darker. These changes switch to using a solid color to ensure that we have always have a consistent border. These changes also add a new theming utility function that converts an rgba color to hex, if the consumer knows the background. We've been using it in a couple of places already, but now it's being moved out into a reusable function.
- Loading branch information
Showing
4 changed files
with
29 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,26 @@ | ||
@import '../core/theming/theming'; | ||
|
||
@mixin mat-sort-theme($theme) { | ||
$background: map-get($theme, background); | ||
$foreground: map-get($theme, foreground); | ||
|
||
.mat-sort-header-arrow { | ||
$table-background: mat-color($background, 'card'); | ||
$text-color: mat-color($foreground, secondary-text); | ||
|
||
// Because the arrow is made up of multiple elements that are stacked on top of each other, | ||
// we can't use the semi-trasparent color from the theme directly. If the value 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. Otherwise, if it resolves to something different | ||
// (e.g. it resolves to a CSS variable), we use the color directly. | ||
$text-color: mat-color($foreground, secondary-text); | ||
$table-background: mat-color($background, 'card'); | ||
|
||
@if (type-of($table-background) == color and type-of($text-color) == color) { | ||
$text-opacity: opacity($text-color); | ||
color: mix($table-background, rgba($text-color, 1), (1 - $text-opacity) * 100%); | ||
color: mat-rgba-to-hex($text-color, $table-background); | ||
} | ||
@else { | ||
color: $text-color; | ||
} | ||
} | ||
} | ||
|
||
@mixin mat-sort-typography($config) { } | ||
@mixin mat-sort-typography($config) {} |