Skip to content

Commit

Permalink
fix: respect contrast color of mini FABs
Browse files Browse the repository at this point in the history
  • Loading branch information
json-derulo committed Mar 21, 2024
1 parent 19ccbab commit 0b98dcb
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions projects/material-css-vars/src/lib/_mat-lib-overwrites.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,39 @@
// FAB component
// ---------------------------
@mixin _mat-mdc-fab-overwrites {
$primary: public-util.mat-css-color(500, null, "primary");
$accent: public-util.mat-css-color(500, null, "accent");
$warn: public-util.mat-css-color(500, null, "warn");
$primary-contrast: public-util.mat-css-color(500, null, "primary", true);
$accent-contrast: public-util.mat-css-color(500, null, "accent", true);
$warn-contrast: public-util.mat-css-color(500, null, "warn", true);

.mat-mdc-fab:not(:disabled),
.mat-mdc-mini-fab:not(:disabled) {
.mat-mdc-fab:not(:disabled) {
&.mat-primary {
--mdc-fab-container-color: #{$primary};
--mat-fab-foreground-color: #{$primary-contrast};
--mat-fab-state-layer-color: #{$primary-contrast};
}
&.mat-accent {
--mdc-fab-container-color: #{$accent};
--mat-fab-foreground-color: #{$accent-contrast};
--mat-fab-state-layer-color: #{$accent-contrast};
}
&.mat-warn {
--mdc-fab-container-color: #{$warn};
--mat-fab-foreground-color: #{$warn-contrast};
--mat-fab-state-layer-color: #{$warn-contrast};
}
}

.mat-mdc-mini-fab:not(:disabled) {
&.mat-primary {
--mat-fab-small-foreground-color: #{$primary-contrast};
--mat-fab-small-state-layer-color: #{$primary-contrast};
}
&.mat-accent {
--mat-fab-small-foreground-color: #{$accent-contrast};
--mat-fab-small-state-layer-color: #{$accent-contrast};
}
&.mat-warn {
--mat-fab-small-foreground-color: #{$warn-contrast};
--mat-fab-small-state-layer-color: #{$warn-contrast};
}
}
}

// ---------------------------
Expand Down

0 comments on commit 0b98dcb

Please sign in to comment.