-
Notifications
You must be signed in to change notification settings - Fork 4.5k
RichText: Support more colors for format boundary colors #70918
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
Conversation
Size Change: +1.86 kB (+0.1%) Total Size: 1.89 MB
ℹ️ View Unchanged
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @vaibhavshinde8478, @ktmn. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
@@ -41,6 +41,7 @@ | |||
"@wordpress/escape-html": "file:../escape-html", | |||
"@wordpress/i18n": "file:../i18n", | |||
"@wordpress/keycodes": "file:../keycodes", | |||
"colord": "2.9.3", |
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.
Side note: This is the third separate version definition of the colord
package. As a follow-up, perhaps we could try to match the version of the packages used across the project.
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.
Thanks, @t-hamano!
@Mamaduka Thanks for the review! |
…0918) Unlinked contributors: vaibhavshinde8478, ktmn. Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
What?
Closes #70909
When the rich text has a format and it receives the focus, the background color based on the current text color is applied. This PR supports more color value variations.
Why?
The current implementation replaces the string dynamically, so the incorrect color may be rendered.
How?
Use the colord library, which is already used by some packages. This library supports some alpha color values and system colors. Additionally, the library does not support colors such as
color-mix()
oroklch()
, but will fall back to black, ensuring that the boundary color will be rendered no matter what color it is.We may be able to choose other libraries if we want to support more complex color values, but I think it's enough to support major colors for now.
Testing Instructions
Screenshots or screencast
body { color: #00ff0080; }
body { color: rgba(255, 0, 0, 0.7); }
body { color: hsla(120, 40%, 70%, 0.7); }
Note that the following colors will not be parsed, and so
background-color: rgba(0, 0, 0, 0.2)
will be applied as a fallback color: