Skip to content

Commit

Permalink
feat(style): allow palettes to specify a separate hue for colored text
Browse files Browse the repository at this point in the history
Fixes #15148
  • Loading branch information
benelliott committed May 24, 2019
1 parent 86da318 commit cb6a989
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/material/button/_button-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ $_mat-button-ripple-opacity: 0.1;
color: inherit;
background: transparent;

@include _mat-button-theme-property($theme, 'color', default);
@include _mat-button-theme-property($theme, 'color', text);
@include _mat-button-focus-overlay-color($theme);

// Setup the ripple color to be based on the text color. This ensures that the ripples
Expand Down
6 changes: 3 additions & 3 deletions src/material/core/option/_option-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@
}

.mat-primary .mat-option.mat-selected:not(.mat-option-disabled) {
color: mat-color($primary);
color: mat-color($primary, text);
}

.mat-accent .mat-option.mat-selected:not(.mat-option-disabled) {
color: mat-color($accent);
color: mat-color($accent, text);
}

.mat-warn .mat-option.mat-selected:not(.mat-option-disabled) {
color: mat-color($warn);
color: mat-color($warn, text);
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/material/core/theming/_theming.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@
// @param $color-map
// @param $primary
// @param $lighter
@function mat-palette($base-palette, $default: 500, $lighter: 100, $darker: 700) {
@function mat-palette($base-palette, $default: 500, $lighter: 100, $darker: 700, $text: $default) {
$result: map_merge($base-palette, (
default: map-get($base-palette, $default),
lighter: map-get($base-palette, $lighter),
darker: map-get($base-palette, $darker),
text: map-get($base-palette, $text),

default-contrast: mat-contrast($base-palette, $default),
lighter-contrast: mat-contrast($base-palette, $lighter),
Expand Down
6 changes: 3 additions & 3 deletions src/material/datepicker/_datepicker-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,14 @@ $mat-calendar-weekday-table-font-size: 11px !default;
}

.mat-datepicker-toggle-active {
color: mat-color(map-get($theme, primary));
color: mat-color(map-get($theme, primary), text);

&.mat-accent {
color: mat-color(map-get($theme, accent));
color: mat-color(map-get($theme, accent), text);
}

&.mat-warn {
color: mat-color(map-get($theme, warn));
color: mat-color(map-get($theme, warn), text);
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/material/form-field/_form-field-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@

// Label colors. Required is used for the `*` star shown in the label.
$label-color: mat-color($foreground, secondary-text, if($is-dark-theme, 0.7, 0.6));
$focused-label-color: mat-color($primary);
$required-label-color: mat-color($accent);
$focused-label-color: mat-color($primary, text);
$required-label-color: mat-color($accent, text);

// Underline colors.
$underline-color-base: mat-color($foreground, divider, if($is-dark-theme, 1, 0.87));
$underline-color-accent: mat-color($accent);
$underline-color-warn: mat-color($warn);
$underline-focused-color: mat-color($primary);
$underline-color-accent: mat-color($accent, text);
$underline-color-warn: mat-color($warn, text);
$underline-focused-color: mat-color($primary, text);

.mat-form-field-label {
color: $label-color;
Expand Down
6 changes: 3 additions & 3 deletions src/material/icon/_icon-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@

.mat-icon {
&.mat-primary {
color: mat-color($primary);
color: mat-color($primary, text);
}

&.mat-accent {
color: mat-color($accent);
color: mat-color($accent, text);
}

&.mat-warn {
color: mat-color($warn);
color: mat-color($warn, text);
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/material/input/_input-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
}

.mat-input-element {
caret-color: mat-color($primary);
caret-color: mat-color($primary, text);

@include input-placeholder {
color: _mat-control-placeholder-color($theme);
Expand All @@ -44,16 +44,16 @@
}

.mat-accent .mat-input-element {
caret-color: mat-color($accent);
caret-color: mat-color($accent, text);
}

.mat-warn .mat-input-element,
.mat-form-field-invalid .mat-input-element {
caret-color: mat-color($warn);
caret-color: mat-color($warn, text);
}

.mat-form-field-type-mat-native-select.mat-form-field-invalid .mat-form-field-infix::after {
color: mat-color($warn);
color: mat-color($warn, text);
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/material/select/_select-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,20 @@
.mat-form-field {
&.mat-focused {
&.mat-primary .mat-select-arrow {
color: mat-color($primary);
color: mat-color($primary, text);
}

&.mat-accent .mat-select-arrow {
color: mat-color($accent);
color: mat-color($accent, text);
}

&.mat-warn .mat-select-arrow {
color: mat-color($warn);
color: mat-color($warn, text);
}
}

.mat-select.mat-select-invalid .mat-select-arrow {
color: mat-color($warn);
color: mat-color($warn, text);
}

.mat-select.mat-select-disabled .mat-select-arrow {
Expand Down
2 changes: 1 addition & 1 deletion src/material/snack-bar/_snack-bar-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
}

.mat-simple-snackbar-action {
color: if($is-dark-theme, inherit, mat-color($accent));
color: if($is-dark-theme, inherit, mat-color($accent, text));
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/material/stepper/_stepper-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@

.mat-step-icon-state-error {
background-color: transparent;
color: mat-color($warn);
color: mat-color($warn, text);
}

.mat-step-label.mat-step-label-active {
color: mat-color($foreground, text);
}

.mat-step-label.mat-step-label-error {
color: mat-color($warn);
color: mat-color($warn, text);
}
}

Expand Down

0 comments on commit cb6a989

Please sign in to comment.