-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Conversation
…d secondary colors
…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 Report
@@ 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.
|
# Conflicts: # packages/mdc-theme/_functions.scss # packages/mdc-theme/_variables.scss
packages/mdc-button/mdc-button.scss
Outdated
@each $theme-style in (primary, accent) { | ||
&.mdc-button--#{$theme-style} { | ||
@each $theme-style in (primary, secondary) { | ||
$modifier: if($theme-style == "secondary", "accent", $theme-style); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
packages/mdc-button/mdc-button.scss
Outdated
@each $theme-style in (primary, accent) { | ||
&.mdc-button--#{$theme-style} { | ||
@each $theme-style in (primary, secondary) { | ||
$modifier: if($theme-style == "secondary", "accent", $theme-style); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
There was a problem hiding this comment.
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. | |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 🙂
packages/mdc-theme/_functions.scss
Outdated
@@ -16,6 +16,11 @@ | |||
|
|||
@import "./constants"; | |||
|
|||
// Used by the functions below to shift a color's lightness by approximately |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Addressed comments, PTAL! |
There was a problem hiding this 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"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
packages/mdc-theme/_variables.scss
Outdated
$mdc-theme-accent: #ff4081 !default; // Pink A200 | ||
$mdc-theme-secondary: $mdc-theme-accent !default; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
packages/mdc-theme/_variables.scss
Outdated
$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. |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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? 😛
docs/getting-started.md
Outdated
@@ -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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
an secondary -> a secondary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
packages/mdc-theme/_variables.scss
Outdated
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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Good idea!
- 💥 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`)
- 💥 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`)
- ⬆️ 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)
mdc-theme
package. Modifier classes for individual components (e.g.,mdc-button--accent
) remain unchanged for now.$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.BREAKING CHANGE