-
Notifications
You must be signed in to change notification settings - Fork 9
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: Add LabelCustomColor component #125
Conversation
Signed-off-by: Mike Turley <[email protected]>
Signed-off-by: Mike Turley <[email protected]>
Signed-off-by: Mike Turley <[email protected]>
🚀 Deployed Storybook Preview: http://migtools-lib-ui-pr-125-preview.surge.sh ✨ |
…t-in ReactNode type Signed-off-by: Mike Turley <[email protected]>
Signed-off-by: Mike Turley <[email protected]>
Signed-off-by: Mike Turley <[email protected]>
Signed-off-by: Mike Turley <[email protected]>
Signed-off-by: Mike Turley <[email protected]>
Signed-off-by: Mike Turley <[email protected]>
Signed-off-by: Mike Turley <[email protected]>
Signed-off-by: Mike Turley <[email protected]>
Signed-off-by: Mike Turley <[email protected]>
Signed-off-by: Mike Turley <[email protected]>
Signed-off-by: Mike Turley <[email protected]>
66f26d4
to
1e809db
Compare
Signed-off-by: Mike Turley <[email protected]>
Signed-off-by: Mike Turley <[email protected]>
const blackTextReadability = () => tinycolor.readability(bgColorObj, '#000000'); | ||
const whiteTextReadability = () => tinycolor.readability(bgColorObj, '#FFFFFF'); | ||
while (blackTextReadability() < 9 && whiteTextReadability() < 9) { | ||
bgColorObj.lighten(5); |
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
} | ||
|
||
const globalColorCache: Record< | ||
string, |
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.
👍
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.
Very cool, Mike!
🎉 This PR is included in version 8.7.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Adds a LabelCustomColor component which attempts to render a PatternFly Label with any given hex color, adjusting colors to maintain acceptable text/background contrast.
Idea: If we have a defined set of colors for Tackle Hub, we could write unit tests here that render labels in every one of those colors and check the contrast with real a11y validators like axe.