-
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
Improve badge colors #2455
Improve badge colors #2455
Conversation
@ryankeairns Is this ready to be looked at? |
@cchaos short answer, yes. That said, I wrote this more under the purview of it being conceptual so the code may need some optimization and organization. I'll move it out of draft. |
c519389
to
3208e89
Compare
74e44a8
to
9fd7e90
Compare
9fd7e90
to
76aa004
Compare
76aa004
to
6e23c90
Compare
df2a365
to
8b537bb
Compare
adf5681
to
242908e
Compare
I am pushing two commits to this PR in regards to the 1. Decreased brightness.Finding out that graphics colors should have at least a ratio of 3:1, I've decreased the brightness of some of the values within the color blind palette to near this ratio. Some values did not quite make it because of the balance of contrast to color blind accessibility. _The "better" colors are what it should be to meet contrast levels but didn't meet color blind accessibility and so it wasn't pushed quite that far._We can continue to tackle the contrast issue in follow ups, but this is not a regression since the old palette also did not meet the contrast standards. 2. Increase the brightness just for badges.The decreased brightness made the contrast of the text to color contrast lower. However, the W3 spec says that once you involve text, only the text needs to have proper contrast and the color contrast between the background of the badge and the page background don't have to meet a certain standard (so long as the color alone doesn't indicate meaning). At @ryankeairns , increasing the brightness by 0.5 was mostly arbitrary. Feel free to tweak this value. |
Colors 0, and 4-8 have been darkend to get closer to a ration of 3:1 though some still don’t quite make it passed 2:1 while still being color-blind acceptable
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.
Found only two actual problems. The rest are mainly optional.
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.
Looks great to me! I think people will be a lot happier with these colors
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 look good, aside from the one question. I'm trying to recall any other components were JS is the only method of providing style; typically there is some Sass fallback, but I could be mistaken.
Fixes #1894
Summary
This PR previously relied on chroma-js to calculate more vibrantly colored badges while also achieving necessary color contrast. In the time since this was originally opened, the EUI color blind palette has been updated to a lighter set of colors with similar objectives... it also leverages chroma-js 🎉
Goal
The intent of this PR is to a) improve the color contrast for some badges while also b) presenting a less muddied visual look.
After comparing the current 'live' badge version versus the original state of this PR and the now updated EUI color blind palette, it became clear that the latter two versions were similar in several spots and shared similar objectives. Relatedly, the original version of this PR resulted in some 'hot' colors that the color blind palette sought to avoid. Here is a look at the three alongside one another:
Comparison
Final solution in this PR
Instead of introducing another shade or our base color set, it seems wise to leverage the new color blind palette by mapping color names (passed via the
EuiBadge
'scolor
prop) to values in the palette. Before (or currently), we are doing some SCSS calculations to shade or tint the base EUI colors. With this PR, we instead use the aforementioned palette colors to achieve our desired outcomes with the bonus of some color consistency.New badges
Additional notes and considerations
EuiBadge
will determine which text color provides the best contrast.Checklist