-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
ProgressBar: use text color to ensure enough contrast against background #55285
Conversation
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 and works great 🚀
I only have a question regarding the fallback track/indicator colors.
Thanks for addressing it @ciampo!
/* Text color at 90% opacity */ | ||
background-color: color-mix( | ||
in srgb, | ||
var( --wp-components-color-foreground, ${ COLORS.gray[ 900 ] } ), |
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.
Do we mean to default both indicator and track color to the same shade of gray? I'd expect the track and indicator fallback colors to be different from each other.
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 PR is implementing this suggestion from Joen. I think that it makes sense to use the same shade of gray and play with opacity, because it ensures high contrast against the 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.
Nice solution @ciampo! This is testing great for me, too, and seems to play nicely with lots of different light and dark combinations:
LGTM! ✨
Just adding the backport to WP Beta/RC label since the issue in #54202 was flagged for 6.4, so it might be worth seeing if this fix can land for 6.4, too 🙂 Edit: I've also swapped out the |
Sorry for being late in checking. Just wanted to report that the progress bar is now displayed very clearly even in Windows high contrast mode 🙌 a59fc11730438aa212dc31ad256653d6.mp4 |
Thanks for taking care of this one and improving it without losing the original spirit. |
…und (#55285) * Use text color at different opacities for track and indicator * Add high contrast mode styles * CHANGELOG # Conflicts: # packages/components/CHANGELOG.md
I just cherry-picked this PR to the 6.4-rc1-2 branch to get it included in the next release: 13d5b22 |
* Add selector as id to layout style overrides. (#55291) * Fix flickering when focusing on global style variations (#55267) * ProgressBar: use text color to ensure enough contrast against background (#55285) * Use text color at different opacities for track and indicator * Add high contrast mode styles * CHANGELOG # Conflicts: # packages/components/CHANGELOG.md * Remove empty attrs. (#54496) * Remove empty attrs. * Fix linter errors --------- Co-authored-by: Sarah Norris <[email protected]> * Add IS_GUTENBERG_PLUGIN flag to LastRevision (#55253) * useBlockPreview: Try outputting EditorStyles to ensure local style overrides are rendered (#55288) * useBlockPreview: Try alternative fix for displaying local style overrides * Avoid duplicate styles, fix rendering issues in Safari * Add more explanatory comments * Remove additional check for styles within the block preview, as it is not needed since EditorStyles handles its own style overrides retrieval * Bug: PHP notice when an image with lightbox is deleted (#55370) * Fix PHP notice when an image with lightbox is deleted * Fix PHP notice when an image with lightbox is deleted --------- Co-authored-by: tellthemachines <[email protected]> Co-authored-by: Aki Hamano <[email protected]> Co-authored-by: Marco Ciampini <[email protected]> Co-authored-by: Jonny Harris <[email protected]> Co-authored-by: Andrew Serong <[email protected]> Co-authored-by: Kishan Jasani <[email protected]>
What?
As discussed in #54202 (comment) and following comments, this PR tweaks the colors used for the
ProgressBar
component (both track and indicator) to be based on the text color.Why?
Using the text color should ensure that the progress bar always has enough contrast when rendered against the background color.
How?
--wp-components-color-foreground
variable for the text colorcolor-mix()
CSS function to tweak the text color's opacityTesting Instructions
In Storybook:
ProgressBar
storyforced-colors: active
mode)In the side editor:
Screenshots or screencast
Storybook:
progress-bar-storybook.mp4
Site editor:
progress-bar-site-editor.mp4