Skip to content

Commit 4c71669

Browse files
committed
Add 0.12 opacity white and black.
1 parent 1818993 commit 4c71669

File tree

5 files changed

+15
-38
lines changed

5 files changed

+15
-38
lines changed

src/lib/button-toggle/_button-toggle-theme.scss

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,10 @@
33

44
// Applies a focus style to an md-button-toggle element for each of the supported palettes.
55
@mixin _mat-button-toggle-focus-color($theme) {
6-
$primary: map-get($theme, primary);
7-
$accent: map-get($theme, accent);
8-
$warn: map-get($theme, warn);
9-
10-
&.mat-primary .mat-button-toggle-focus-overlay {
11-
background-color: mat-color($primary, 0.12);
12-
}
13-
14-
&.mat-accent .mat-button-toggle-focus-overlay {
15-
background-color: mat-color($accent, 0.12);
16-
}
6+
$foreground: map-get($theme, foreground);
177

18-
&.mat-warn .mat-button-toggle-focus-overlay {
19-
background-color: mat-color($warn, 0.12);
8+
.mat-button-toggle-focus-overlay {
9+
background-color: mat-color($foreground, divider);
2010
}
2111
}
2212

src/lib/button-toggle/button-toggle.scss

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
@import '../core/style/elevation';
21
@import '../core/a11y/a11y';
2+
@import '../core/style/elevation';
3+
@import '../core/style/layout-common';
34

45
$mat-button-toggle-padding: 0 16px !default;
56
$mat-button-toggle-line-height: 36px !default;
@@ -58,22 +59,8 @@ $mat-button-toggle-border-radius: 2px !default;
5859
// element, however we use a proper DOM element in order to be able to disable the default
5960
// touch action. This makes the buttons more responsive on touch devices.
6061
.mat-button-toggle-focus-overlay {
61-
// The button spec calls for focus on raised buttons (and FABs) to be indicated with a
62-
// black, 12% opacity shade over the normal color (for both light and dark themes).
63-
background-color: rgba(black, 0.12);
6462
border-radius: inherit;
6563
pointer-events: none;
6664
opacity: 0;
67-
position: absolute;
68-
top: 0;
69-
left: 0;
70-
bottom: 0;
71-
right: 0;
72-
73-
@include cdk-high-contrast {
74-
// Note that IE will render this in the same way, no
75-
// matter whether the theme is light or dark. This helps
76-
// with the readability of focused buttons.
77-
background-color: rgba(white, 0.5);
78-
}
65+
@include mat-fill;
7966
}

src/lib/button-toggle/button-toggle.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,13 @@ import {
1414
MdButtonToggleGroupMultiple,
1515
MdButtonToggleChange, MdButtonToggleModule,
1616
} from './button-toggle';
17-
import {FocusOriginMonitor} from '../core';
1817

1918

2019
describe('MdButtonToggle', () => {
2120

2221
beforeEach(async(() => {
2322
TestBed.configureTestingModule({
2423
imports: [MdButtonToggleModule.forRoot(), FormsModule, ReactiveFormsModule],
25-
providers: [FocusOriginMonitor],
2624
declarations: [
2725
ButtonTogglesInsideButtonToggleGroup,
2826
ButtonToggleGroupWithNgModel,

src/lib/button-toggle/button-toggle.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ export class MdButtonToggle implements OnInit {
480480
CompatibilityModule,
481481
],
482482
declarations: [MdButtonToggleGroup, MdButtonToggleGroupMultiple, MdButtonToggle],
483-
providers: [UNIQUE_SELECTION_DISPATCHER_PROVIDER]
483+
providers: [UNIQUE_SELECTION_DISPATCHER_PROVIDER, FocusOriginMonitor]
484484
})
485485
export class MdButtonToggleModule {
486486
/** @deprecated */

src/lib/core/theming/_palette.scss

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
$black-87-opacity: rgba(black, 0.87);
1010
$white-87-opacity: rgba(white, 0.87);
11+
$black-12-opacity: rgba(black, 0.12);
12+
$white-12-opacity: rgba(white, 0.12);
1113

1214
$mat-red: (
1315
50: #ffebee,
@@ -649,7 +651,7 @@ $mat-light-theme-background: (
649651
hover: rgba(black, 0.04), // TODO(kara): check style with Material Design UX
650652
card: white,
651653
dialog: white,
652-
disabled-button: rgba(black, 0.12),
654+
disabled-button: $black-12-opacity,
653655
raised-button: white,
654656
);
655657

@@ -661,15 +663,15 @@ $mat-dark-theme-background: (
661663
hover: rgba(white, 0.04), // TODO(kara): check style with Material Design UX
662664
card: map_get($mat-grey, 800),
663665
dialog: map_get($mat-grey, 800),
664-
disabled-button: rgba(white, 0.12),
666+
disabled-button: $white-12-opacity,
665667
raised-button: map-get($mat-grey, 800),
666668
);
667669

668670
// Foreground palette for light themes.
669671
$mat-light-theme-foreground: (
670672
base: black,
671-
divider: rgba(black, 0.12),
672-
dividers: rgba(black, 0.12),
673+
divider: $black-12-opacity,
674+
dividers: $black-12-opacity,
673675
disabled: rgba(black, 0.38),
674676
disabled-button: rgba(black, 0.38),
675677
disabled-text: rgba(black, 0.38),
@@ -683,8 +685,8 @@ $mat-light-theme-foreground: (
683685
// Foreground palette for dark themes.
684686
$mat-dark-theme-foreground: (
685687
base: white,
686-
divider: rgba(white, 0.12),
687-
dividers: rgba(white, 0.12),
688+
divider: $white-12-opacity,
689+
dividers: $white-12-opacity,
688690
disabled: rgba(white, 0.3),
689691
disabled-button: rgba(white, 0.3),
690692
disabled-text: rgba(white, 0.3),

0 commit comments

Comments
 (0)