Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(theme): Add light/dark variants for primary/secondary color, and rename accent to secondary #1116

Merged
merged 18 commits into from
Aug 15, 2017

Conversation

acdvorak
Copy link
Contributor

  • In the spec, "accent" was renamed to "secondary".
  • This PR only changes "accent" to "secondary" for variables defined within the mdc-theme package. Modifier classes for individual components (e.g., mdc-button--accent) remain unchanged for now.
  • For backward compatibility, $mdc-theme-accent still exists, and $mdc-theme-secondary points to it. This ensures that clients that were previously overriding $mdc-theme-accent will continue to work.
  • Light/dark tonal variants are not yet being used, but will become used soon when we update our components to align with an upcoming version of the spec.

BREAKING CHANGE

…nts for all CSS classes/vars

Modifier classes for individual components (e.g., `mdc-button--accent`) are **NOT** renamed. We are currently considering our options for renaming those at a later date.
@codecov-io
Copy link

codecov-io commented Aug 11, 2017

Codecov Report

Merging #1116 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff           @@
##           master   #1116   +/-   ##
======================================
  Coverage    99.9%   99.9%           
======================================
  Files          69      69           
  Lines        3302    3302           
  Branches      405     405           
======================================
  Hits         3299    3299           
  Misses          3       3

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7d9023b...e7d5cd4. Read the comment docs.

acdvorak and others added 2 commits August 11, 2017 12:53
@each $theme-style in (primary, accent) {
&.mdc-button--#{$theme-style} {
@each $theme-style in (primary, secondary) {
$modifier: if($theme-style == "secondary", "accent", $theme-style);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comment about why this is around...basically about backwards compatibility

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@each $theme-style in (primary, accent) {
&.mdc-button--#{$theme-style} {
@each $theme-style in (primary, secondary) {
$modifier: if($theme-style == "secondary", "accent", $theme-style);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -59,7 +59,7 @@ The provided modifiers are:
| --------------------- | ------------------------------------------------------- |
| `mdc-linear-progress--indeterminate` | Puts the linear progress indicator in an indeterminate state. |
| `mdc-linear-progress--reversed` | Reverses the direction of the linear progress indicator. |
| `mdc-linear-progress--accent` | Colors the button with the accent color. |
| `mdc-linear-progress--accent` | Colors the button with the secondary color. |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

colors the "button"? Is this correct? Or some old copy/paste bug?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done - looks like an old copy/paste bug 🙂

@@ -16,6 +16,11 @@

@import "./constants";

// Used by the functions below to shift a color's lightness by approximately
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think you need these new functions in this PR, can you move it to another one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@acdvorak
Copy link
Contributor Author

Addressed comments, PTAL!

Copy link
Contributor

@lynnmercier lynnmercier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there other components, more than just MDC Button, which need updating? Some might still be using "accent"

Copy link
Contributor

@lynnmercier lynnmercier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

$mdc-theme-accent: #ff4081 !default; // Pink A200
$mdc-theme-secondary: $mdc-theme-accent !default;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be the other way around? i.e. assign the actual value to secondary, then assign secondary to accent?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would break backward compatibility for existing clients who are already overriding accent, because we would no longer be reading the value that they're setting.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah, that's true. Since the comment above already explains that accent only exists now for backcompat, this should be fine.

$mdc-theme-primary-light: lighten($mdc-theme-primary, 14%) !default;
$mdc-theme-primary-dark: darken($mdc-theme-primary, 14%) !default;

// The $mdc-theme-secondary variable is DEPRECATED - it exists purely for backward compatibility.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overzealous find/replace? The accent variable is what's deprecated, right?

Copy link
Contributor Author

@acdvorak acdvorak Aug 15, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you always insist on catching my mistakes, Ken? 😛

@@ -216,7 +216,7 @@ hit the button, and get a pleasant greeting :wave:
You may have noticed that the button background, as well as the label and underline on focused text
input fields, defaults to the Indigo 500 (`#673AB7`) color from the [Material Design color palette](https://material.io/guidelines/style/color.html#color-color-palette).
This is part of the default theme that ships with MDC-Web; it uses Indigo 500 for a primary color, and
Pink A200 (`#FF4081`) for an accent color. Let's change the theme's primary color.
Pink A200 (`#FF4081`) for an secondary color. Let's change the theme's primary color.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

an secondary -> a secondary

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

text-hint-on-secondary-dark: map-get(map-get($mdc-theme-text-colors, $mdc-theme-secondary-dark-tone), hint),
text-disabled-on-secondary-dark: map-get(map-get($mdc-theme-text-colors, $mdc-theme-secondary-dark-tone), disabled),
text-icon-on-secondary-dark: map-get(map-get($mdc-theme-text-colors, $mdc-theme-secondary-dark-tone), icon),
// Text-primary on background background
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks kind of funny... maybe for each of these comments surround each background name in quotes or backticks? e.g. "background" background or `background` background

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Good idea!

@acdvorak acdvorak merged commit 2314ad5 into master Aug 15, 2017
@acdvorak acdvorak deleted the feat/m2-theme/step02-light-dark-variants branch August 16, 2017 07:49
acdvorak added a commit that referenced this pull request Aug 17, 2017
… instead of `accent` (#1156)

The build was accidentally broken in PR #1074 due to a merge conflict with PR #1116.
Kerrick added a commit to secondstreet/ember-material-components-web that referenced this pull request Sep 6, 2017
- 💥 Change "accent" to "secondary" globally, as done by MDC-Web.
  material-components/material-components-web#1116
- ✨ `{{mdc-button}}` now has `unelevated` boolean attribute (default: `false`)
- ✨ `{{mdc-button}}` now has `dense` boolean attribute (default: `false`)
- ✨ `{{mdc-button}}` now has `compact` boolean attribute (default: `false`)
- ✨ `{{mdc-textfield}}` now has `box` boolean attribute (default: `false`)
Kerrick added a commit to secondstreet/ember-material-components-web that referenced this pull request Sep 6, 2017
- 💥 Change "accent" to "secondary" globally, as done by MDC-Web.
  material-components/material-components-web#1116
- ✨ `{{mdc-button}}` now has `unelevated` boolean attribute (default: `false`)
- ✨ `{{mdc-button}}` now has `dense` boolean attribute (default: `false`)
- ✨ `{{mdc-button}}` now has `compact` boolean attribute (default: `false`)
- ✨ `{{mdc-textfield}}` now has `box` boolean attribute (default: `false`)
Kerrick added a commit to secondstreet/ember-material-components-web that referenced this pull request Sep 7, 2017
- ⬆️ Upgrade @Material packages to 0.19 versions
    - 💥 Change "accent" to "secondary" globally, as done by MDC-Web.
      material-components/material-components-web#1116
    - ✨ `{{mdc-button}}` now has `unelevated` boolean attribute (default: `false`)
    - ✨ `{{mdc-button}}` now has `dense` boolean attribute (default: `false`)
    - ✨ `{{mdc-button}}` now has `compact` boolean attribute (default: `false`)
    - ✨ `{{mdc-textfield}}` now has `box` boolean attribute (default: `false`)
- 🐛 `{{mdc-checkbox}}`, `{{mdc-radio}}`, and `{{mdc-switch}}` now respect checked attr (#29)
- 💚 Switch CI to use Headless Chrome (#28)
- ✨ Event bubbling can be disabled for checkboxes, radio buttons, and switches (#27)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants