ProgressBar: use text color to ensure enough contrast against background#55285
ProgressBar: use text color to ensure enough contrast against background#55285
Conversation
| /* 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.
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.
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.
andrewserong
left a comment
There was a problem hiding this comment.
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 <sarah@sekai.co.uk> * 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 <tellthemachines@users.noreply.github.com> Co-authored-by: Aki Hamano <54422211+t-hamano@users.noreply.github.com> Co-authored-by: Marco Ciampini <marco.ciampo@gmail.com> Co-authored-by: Jonny Harris <spacedmonkey@users.noreply.github.com> Co-authored-by: Andrew Serong <14988353+andrewserong@users.noreply.github.com> Co-authored-by: Kishan Jasani <kishanjasani007@yahoo.in>
What?
As discussed in #54202 (comment) and following comments, this PR tweaks the colors used for the
ProgressBarcomponent (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-foregroundvariable for the text colorcolor-mix()CSS function to tweak the text color's opacityTesting Instructions
In Storybook:
ProgressBarstoryforced-colors: activemode)In the side editor:
Screenshots or screencast
Storybook:
progress-bar-storybook.mp4
Site editor:
progress-bar-site-editor.mp4