-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Simplify color specifications from rgba
to rgb
#70008
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
Simplify color specifications from rgba
to rgb
#70008
Conversation
Currently, the theme.json that ships in core at `wp-includes/theme.json` default gradients are inconsistent in color specification -- a number of places it uses `rgba(#,#,#,1)` even though that is equivalent to just `rgb(#,#,#)` -- there is no rhyme or reason I can see as to why rgba is used here, so this is to trim a couple bytes by serving them up as rgb instead of rgba. As there is no transparency here, it may be slightly more efficient to use hex? But I'm fine leaving it as RGB for less code churn in core unless anyone feels strongly here.
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 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. |
cc @WordPress/block-themers |
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.
Good catch! Thanks for your PR.
Looks good to me. I saw that in TT4's theme.json
we use hex values for gradients, so we may want to consider that for consistency.
Happy to see us switch over to it -- especially as hex now supports alpha transparency if needed. |
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.
Thank you, @georgestephanis and @juanfra!
@georgestephanis Thanks for working on this! Do you have the bandwidth to submit a core ticket and patch? The |
Sure, I'll get it in today. |
Trac ticket that ^^ is for: |
…on`. `rgba(#,#,#,1)` is equivalent to `rgb(#,#,#)` and can be replaced with the latter for more consistency. Original PR from Gutenberg repository: * [WordPress/gutenberg#70008 #70008 Simplify color specifications from rgba to rgb] Follow-up to [50959], [55405]. Props georgestephanis, wildworks, juanfra. Fixes #63381. git-svn-id: https://develop.svn.wordpress.org/trunk@60234 602fd350-edb4-49c9-b593-d223f7449a82
…on`. `rgba(#,#,#,1)` is equivalent to `rgb(#,#,#)` and can be replaced with the latter for more consistency. Original PR from Gutenberg repository: * [WordPress/gutenberg#70008 #70008 Simplify color specifications from rgba to rgb] Follow-up to [50959], [55405]. Props georgestephanis, wildworks, juanfra. Fixes #63381. Built from https://develop.svn.wordpress.org/trunk@60234 git-svn-id: http://core.svn.wordpress.org/trunk@59570 1a063a9b-81f0-0310-95a4-ce76da25c4cd
…on`. `rgba(#,#,#,1)` is equivalent to `rgb(#,#,#)` and can be replaced with the latter for more consistency. Original PR from Gutenberg repository: * [WordPress/gutenberg#70008 #70008 Simplify color specifications from rgba to rgb] Follow-up to [50959], [55405]. Props georgestephanis, wildworks, juanfra. Fixes #63381. Built from https://develop.svn.wordpress.org/trunk@60234 git-svn-id: https://core.svn.wordpress.org/trunk@59570 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* Simplify color specifications from `rgba` to `rgb` Currently, the theme.json that ships in core at `wp-includes/theme.json` default gradients are inconsistent in color specification -- a number of places it uses `rgba(#,#,#,1)` even though that is equivalent to just `rgb(#,#,#)` -- there is no rhyme or reason I can see as to why rgba is used here, so this is to trim a couple bytes by serving them up as rgb instead of rgba. As there is no transparency here, it may be slightly more efficient to use hex? But I'm fine leaving it as RGB for less code churn in core unless anyone feels strongly here. * Update test to account for changed default. Co-authored-by: georgestephanis <georgestephanis@git.wordpress.org> Co-authored-by: juanfra <juanfra@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Currently, the theme.json that ships in core at
wp-includes/theme.json
default gradients are inconsistent in color specification -- a number of places it usesrgba(#,#,#,1)
even though that is equivalent to justrgb(#,#,#)
-- there is no rhyme or reason I can see as to why rgba is used here, so this is to trim a couple bytes by serving them up as rgb instead of rgba.As there is no transparency here, it may be slightly more efficient to use hex? But I'm fine leaving it as RGB for less code churn in core unless anyone feels strongly here.
Why?
Simplifying color specifications in core boilerplates -- more consistency in code style standards.
How?
Dropping the opacity specification when it's full opacity.
Testing Instructions