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

[EuiIcon, EuiButtonIcon] Improved contrast for named colors #4049

Merged
merged 13 commits into from
Sep 24, 2020

Conversation

miukimiu
Copy link
Contributor

@miukimiu miukimiu commented Sep 17, 2020

Summary

Closes #3728.

The EuiHealth named colors (primary, secondary, success, accent, warning...) were looking too dark because they were using the SASS function makeHighContrastColor() that works best for text-specific cases.

This PR replaces the named colors that were using makeHighContrastColor() and replaces with a makeGraphicContrastColor() function. This way, named colors like warning looks lighter.

Health Colors@2x

Checklist

  • Check against all themes for compatibility in both light and dark modes
  • [ ] Checked in mobile
  • Checked in Chrome, Safari, Edge, and Firefox
  • [ ] Props have proper autodocs
  • [ ] Added documentation
  • [ ] Checked Code Sandbox works for the any docs examples
  • [ ] Added or updated jest tests
  • [ ] Checked for breaking changes and labeled appropriately
  • Checked for accessibility including keyboard-only and screenreader modes
  • A changelog entry exists and is marked appropriately

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_4049/

@miukimiu miukimiu changed the title [EuiIcon] Improved contrast for named colors [EuiHealth] Improved contrast for named colors Sep 18, 2020
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_4049/

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_4049/

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_4049/

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_4049/

src-docs/src/components/guide_components.scss Show resolved Hide resolved
const classes = classNames('euiHealth', className);

return (
<div className={classes} {...rest}>
<EuiFlexGroup gutterSize="xs" alignItems="center" responsive={false}>
<EuiFlexItem grow={false}>
<EuiIcon type="dot" color={color} />
<EuiIcon type="dot" {...healthColor} />
Copy link
Contributor

Choose a reason for hiding this comment

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

Just being nitpicky here but also want to be sure we're following our own conventions. Your classnames you've constructed that would be added here are using the BEM syntax that would be applied to the outer most element euiHealth--primary, but you're applying it to the icon which would normally be called euiHealth__icon--primary.

success: makeGraphicContrastColor($euiColorSuccess),
subdued: $euiTextSubduedColor,
text: $euiTextColor,
warning: makeGraphicContrastColor($euiColorWarning),
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these all the same values used in EuiHealth? If so, I think it's ok to let the EuiIcon color handle the coloring without actually needing to re-apply the coloring in EuiHealth specifically.

Meaning passing color="accent" from EuiHealth to the embedded EuiIcon will produce the same rendered color (makeHighContrast), so why not just complicate it less.

Though there can be the argument that also having the custom coloring in EuiHealth helps ensure EuiHealth can maintain it's own coloring.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I reverted the EuiHealth code to what it was originally. This way the EuiIcon is handling the color for it.

This was actually how I started the PR by just changing the EuiIcon colors so I believe it's the best way.

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_4049/

@miukimiu miukimiu changed the title [EuiHealth] Improved contrast for named colors [EuiIcon, EuiButtonIcon] Improved contrast for named colors Sep 24, 2020
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_4049/

Copy link
Contributor

@cchaos cchaos left a comment

Choose a reason for hiding this comment

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

👍 Looks great to me! I think this is def the simplest fix. We can always specifically address EuiHealth later if necessary.

@miukimiu miukimiu merged commit 4ed1089 into elastic:master Sep 24, 2020
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.

[EuiHealth] Warning color could be lightened to the graphic contrast levels instead of text
3 participants