-
Notifications
You must be signed in to change notification settings - Fork 841
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
[EuiProgress] Add support for more colors #4130
Conversation
Preview documentation changes for this PR: https://eui.elastic.co/pr_4130/ |
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 is a nice expansion of the color
prop to allow consumers to easily color with our visualization palette. 😍
The one thing that's not quite addressed in this PR that #3618 is asking for, is to be able to completely customize the color by passing a valid hex or rgb or other valid color type. That's where this can get complicated.
I wonder if it can be done similarly to EuiIcon, where a custom color gets applied in the inline style tag as the text color like style={{ color: customColor }}
and then in the CSS we use currentColor
to color the fill.
The only thing is that we couldn't then apply the makeHighContrastColor()
mixin for the text color, but we could either caveat the example description with this or we do have a way to increase the contrast of a color in JS for just the text portion.
@cchaos I didn't know about |
Preview documentation changes for this PR: https://eui.elastic.co/pr_4130/ |
I looked through some of our components where I thought we were using it, but we don't seem to have this exact implementation of changing the actual color. So I think we could just put a callout in the docs saying that we don't do any adjustment for contrast when applying the custom color to the text. |
Preview documentation changes for this PR: https://eui.elastic.co/pr_4130/ |
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.
Updates are great. Here's a code review.
Looks like we're missing tests for the color
prop. You'll also want to be sure to add one specifically for the custom color as well.
Co-authored-by: Caroline Horn <[email protected]>
Preview documentation changes for this PR: https://eui.elastic.co/pr_4130/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_4130/ |
1 similar comment
Preview documentation changes for this PR: https://eui.elastic.co/pr_4130/ |
@cchaos thanks for the review. I addressed the feedback and added tests (we were also missing one for |
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.
Nice! Looks great! I tested in Chrome, FF, and Safari and they all render the proper color. 👍
@chandlerprall Want to take a quick peak at the JS side?
@@ -95,4 +95,24 @@ describe('EuiProgress', () => { | |||
|
|||
expect(component).toMatchSnapshot(); | |||
}); | |||
|
|||
describe('color', () => { | |||
[...COLORS, '#885522'].forEach((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.
🌟
Co-authored-by: Caroline Horn <[email protected]>
Preview documentation changes for this PR: https://eui.elastic.co/pr_4130/ |
I think CI is failing on Prettier of the |
Preview documentation changes for this PR: https://eui.elastic.co/pr_4130/ |
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.
Changes LGTM!
Preview documentation changes for this PR: https://eui.elastic.co/pr_4130/ |
Summary
EuiProgress
(tint1
totint9
),warning
andsuccess
.Note: Colors
success
andsecondary
use the same color, I've leftsecondary
as an option thinking of consumers that might already be usingsecondary
in their current implementations.Fixes #4117 #3618
Checklist
- [ ] Props have proper autodocs- [ ] Checked Code Sandbox works for the any docs examples- [ ] Checked for breaking changes and labeled appropriately- [ ] Checked for accessibility including keyboard-only and screenreader modes