Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit f2996b7

Browse files
committed
feat(theming): change default color of components that should be accent
BREAKING CHANGE: As per the [spec](http://www.google.com/design/spec/style/color.html#color-ui-color-application) this commit changes the default color palette of FABs, checkboxes, radio buttons, sliders and switches to the accent palette. closes #1255
1 parent 279d3b9 commit f2996b7

13 files changed

Lines changed: 60 additions & 33 deletions

File tree

src/components/button/button-theme.scss

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,17 @@ md-toolbar .md-button.md-THEME_NAME-theme.md-fab {
3232

3333
&.md-fab {
3434
border-radius: $button-fab-border-radius;
35+
background-color: '{{accent-color}}';
36+
color: '{{accent-contrast}}';
37+
&:not([disabled]) {
38+
&:hover,
39+
&:focus {
40+
background-color: '{{accent-A700}}';
41+
}
42+
}
3543
}
3644

37-
&.md-raised,
38-
&.md-fab {
45+
&.md-raised {
3946
color: '{{background-contrast}}';
4047
background-color: '{{background-500-0.185}}';
4148
&:not([disabled]) {

src/components/button/button.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ angular.module('material.components.button', [
2626
* If you supply a `href` or `ng-href` attribute, it will become an `<a>` element. Otherwise, it will
2727
* become a `<button>` element.
2828
*
29+
* As per the [material design spec](http://www.google.com/design/spec/style/color.html#color-ui-color-application)
30+
* the FAB button is in the accent color by default. The primary color palette may be used with
31+
* the `md-primary` class.
32+
*
2933
* @param {boolean=} md-no-ink If present, disable ripple ink effects.
3034
* @param {expression=} ng-disabled En/Disable based on the expression
3135
* @param {string=} aria-label Adds alternative text to button for accessibility, useful for icon buttons.

src/components/button/demoBasicUsage/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<md-icon icon="/img/icons/ic_access_time_24px.svg" style="width: 24px; height: 24px;"></md-icon>
2323
</md-button>
2424

25-
<md-button class="md-fab" aria-label="New document">
25+
<md-button class="md-fab md-primary" aria-label="New document">
2626
<md-icon icon="/img/icons/ic_insert_drive_file_24px.svg" style="width: 24px; height: 24px;"></md-icon>
2727
</md-button>
2828

src/components/checkbox/checkbox-theme.scss

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
md-checkbox.md-THEME_NAME-theme {
22

33
.md-ripple {
4-
color: '{{primary-600}}';
4+
color: '{{accent-600}}';
55
}
66
&.md-checked .md-ripple {
77
color: '{{background-600}}';
@@ -11,17 +11,17 @@ md-checkbox.md-THEME_NAME-theme {
1111
border-color: '{{foreground-2}}';
1212
}
1313
&.md-checked .md-icon {
14-
background-color: '{{primary-color-0.87}}';
14+
background-color: '{{accent-color-0.87}}';
1515
}
1616

1717
&.md-checked .md-icon:after {
1818
border-color: '{{background-200}}';
1919
}
2020

2121
&:not([disabled]) {
22-
&.md-accent {
22+
&.md-primary {
2323
.md-ripple {
24-
color: '{{accent-600}}';
24+
color: '{{primary-600}}';
2525
}
2626
&.md-checked .md-ripple {
2727
color: '{{background-600}}';
@@ -31,7 +31,7 @@ md-checkbox.md-THEME_NAME-theme {
3131
border-color: '{{foreground-2}}';
3232
}
3333
&.md-checked .md-icon {
34-
background-color: '{{accent-color-0.87}}';
34+
background-color: '{{primary-color-0.87}}';
3535
}
3636

3737
&.md-checked .md-icon:after {

src/components/checkbox/checkbox.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ angular.module('material.components.checkbox', [
2020
* @description
2121
* The checkbox directive is used like the normal [angular checkbox](https://docs.angularjs.org/api/ng/input/input%5Bcheckbox%5D).
2222
*
23+
* As per the [material design spec](http://www.google.com/design/spec/style/color.html#color-ui-color-application)
24+
* the checkbox is in the accent color by default. The primary color palette may be used with
25+
* the `md-primary` class.
26+
*
2327
* @param {string} ng-model Assignable angular expression to data-bind to.
2428
* @param {string=} name Property name of the form under which the control is published.
2529
* @param {expression=} ng-true-value The value to which the expression should be set when selected.

src/components/checkbox/demoBasicUsage/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
Checkbox: Disabled, Checked
1818
</md-checkbox>
1919

20-
<md-checkbox md-no-ink aria-label="Checkbox No Ink" ng-model="data.cb5" class="md-accent">
21-
Checkbox (md-accent): No Ink
20+
<md-checkbox md-no-ink aria-label="Checkbox No Ink" ng-model="data.cb5" class="md-primary">
21+
Checkbox (md-primary): No Ink
2222
</md-checkbox>
2323
</div>

src/components/radioButton/radio-button-theme.scss

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,32 @@ md-radio-button.md-THEME_NAME-theme {
55
}
66

77
.md-on {
8-
background-color: '{{primary-color-0.87}}';
8+
background-color: '{{accent-color-0.87}}';
99
}
1010
&.md-checked .md-off {
11-
border-color: '{{primary-color-0.87}}';
11+
border-color: '{{accent-color-0.87}}';
1212
}
1313
&.md-checked .md-ink-ripple {
14-
color: '{{primary-color-0.87}}';
14+
color: '{{accent-color-0.87}}';
1515
}
1616
.md-container .md-ripple {
17-
color: '{{primary-600}}';
17+
color: '{{accent-600}}';
1818
}
1919

2020
&:not([disabled]) {
2121

22-
&.md-accent {
22+
&.md-primary {
2323
.md-on {
24-
background-color: '{{accent-color-0.87}}';
24+
background-color: '{{primary-color-0.87}}';
2525
}
2626
&.md-checked .md-off {
27-
border-color: '{{accent-color-0.87}}';
27+
border-color: '{{primary-color-0.87}}';
2828
}
2929
&.md-checked .md-ink-ripple {
30-
color: '{{accent-color-0.87}}';
30+
color: '{{primary-color-0.87}}';
3131
}
3232
.md-container .md-ripple {
33-
color: '{{accent-600}}';
33+
color: '{{primary-600}}';
3434
}
3535
}
3636

src/components/radioButton/radioButton.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ angular.module('material.components.radioButton', [
2525
* container for the 1..n grouped radio buttons; specified using nested
2626
* `<md-radio-button>` tags.
2727
*
28+
* As per the [material design spec](http://www.google.com/design/spec/style/color.html#color-ui-color-application)
29+
* the radio button is in the accent color by default. The primary color palette may be used with
30+
* the `md-primary` class.
31+
*
2832
* Note: `<md-radio-group>` and `<md-radio-button>` handle tabindex differently
2933
* than the native `<input type='radio'>` controls. Whereas the native controls
3034
* force the user to tab through all the radio buttons, `<md-radio-group>`

src/components/slider/slider-theme.scss

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,23 +56,23 @@ md-slider.md-THEME_NAME-theme {
5656
}
5757
}
5858

59-
&.md-accent {
59+
&.md-primary {
6060
.md-track-fill {
61-
background-color: '{{accent-color}}';
61+
background-color: '{{primary-color}}';
6262
}
6363
.md-thumb:after {
64-
border-color: '{{accent-color}}';
65-
background-color: '{{accent-color}}';
64+
border-color: '{{primary-color}}';
65+
background-color: '{{primary-color}}';
6666
}
6767
.md-sign {
68-
background-color: '{{accent-color}}';
68+
background-color: '{{primary-color}}';
6969

7070
&:after {
71-
border-top-color: '{{accent-color}}';
71+
border-top-color: '{{primary-color}}';
7272
}
7373
}
7474
.md-thumb-text {
75-
color: '{{accent-contrast}}';
75+
color: '{{primary-contrast}}';
7676
}
7777
}
7878

src/components/slider/slider.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ angular.module('material.components.slider', [
1919
* The `<md-slider>` component allows the user to choose from a range of
2020
* values.
2121
*
22+
* As per the [material design spec](http://www.google.com/design/spec/style/color.html#color-ui-color-application)
23+
* the slider is in the accent color by default. The primary color palette may be used with
24+
* the `md-primary` class.
25+
*
2226
* It has two modes: 'normal' mode, where the user slides between a wide range
2327
* of values, and 'discrete' mode, where the user slides between only a few
2428
* select values.

0 commit comments

Comments
 (0)