-
Notifications
You must be signed in to change notification settings - Fork 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
Colour Scheming: Update External Brand Variables #30084
Conversation
Okay, I think that's the last of them. 👍 Still not familiar with squashing yet, but I'm hoping/assuming that can be done by whoever merges. Added testing instructions above! :) (cc @flootr) |
} | ||
&.is-google-plus { | ||
fill: #df4a33; | ||
fill: var( --color-gplus ); |
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.
Agreed. Are all the hex values the same?
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.
These ones are, but the ones here are a bit different. The HEX code seem are identical visually to the actual social media icons though, so I'm assuming they also should use a variable.
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.
Make sure this works it IE11 and that the fallback hex codes get properly inserted.
@@ -900,24 +900,24 @@ | |||
} | |||
} | |||
|
|||
@include sharing-button-service( 'facebook', $color-facebook ); | |||
@include sharing-button-service( 'twitter', $color-twitter ); | |||
@include sharing-button-service( 'facebook', var( --color-facebook )); |
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.
I think those won't work. The sharing-button-service
passes those values to an rgb( ... )
function which doesn't know how to deal with hex values. The way we work around this is using the hex-to-rgb
sass function defined here. You can see a usage example here.
You could either define a -rgb
version of each CSS custom prop or use the hex-to-rgb( ... )
function directly at this place. As far as I can see we don't pass those color variables anywhere else to an rgba( .... )
function so the latter is probably fine.
Let me know if that makes sense to you.
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.
I think so, but just to confirm. Something like this?
@include sharing-button-service( 'facebook', var( --color-facebook )); | |
@include sharing-button-service( 'facebook', rgba(var( --color-facebook ))); |
That looks like a confusing number of brackets though and just doesn't look right, so just want to be sure.
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.
Sorry, I think it would've been more clear from my side if I provided a code example. What I meant is the following:
/* _color-schemes.scss */
--color-facebook: #{$color-facebook};
--color-facebook-rgb: #{hex-to-rgb( $color-facebook )};
// this file
@include sharing-button-service( 'facebook', var( --color-facebook-rgb ));
This is necessary because the sharing-button-service
mixin is passing it to rgba( ... )
here:
wp-calypso/client/my-sites/sharing/style.scss
Lines 897 to 899 in 2d50a28
&:hover { | |
background: rgba( $color, 0.9 ); | |
} |
and the above rgba
function doesn't work with hex values
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, that helps a ton! Just one more question, since $color-facebook
would otherwise be removed, should they use HEX codes instead?
--color-facebook-rgb: #{hex-to-rgb( #39579a )};
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.
I think that'd work. Only notice that we need both --color-facebook
and --color-facebook-rgb
so there's some repetition but I think that may be fine in this case.
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! I've added a commit which intends to address this. Do you know if that's the same case here too?
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.
The color values are directly used in the mentioned mixin so we can use the normal variables (without the -rgb
suffix) there.
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.
Found one last thing. Apart from that this should be ready to go 👍
client/my-sites/sharing/style.scss
Outdated
@include sharing-button-service( 'facebook', $color-facebook ); | ||
@include sharing-button-service( 'twitter', $color-twitter ); | ||
@include sharing-button-service( 'facebook', var( --color-facebook-rgb )); | ||
@include sharing-button-service( 'twitter', var( --color-twitter-rgb )); | ||
@include sharing-button-service( 'press-this', $blue-wordpress ); |
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 could use var( --color-primary-rgb )
instead of $blue-wordpress
, correct?
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.
Yep, added a commit for that. :)
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.
@torres126 Press This is a WordPress brand so it should use the new --color-wpcom variable, please. In other words, we don't want the color to change with schemes, which --color-primary might do.
Why are these rgb by the way?
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.
Oh I see you all discussed it above.
Sorry to come in late on this! I think we can eliminate the need for the rgb variables for the brands. We need to get rid of the sharing-button-service mixin wp-calypso/client/my-sites/sharing/style.scss Lines 897 to 899 in 2d50a28
I don't think it's doing much visually. You can see that there's already an opacity change on the container div — we don't need more opacity on the color: |
Oh, oops, I added a commit to start on the Press This issue right as you posted that. 😅 So just to confirm here, what needs to be got rid of? Just keep lines 897-899, and then using the normal variables on 903-920, before removing the RGB variables added earlier? |
--color-whatsapp: #{$color-whatsapp}; | ||
--color-wordpress-org: #{$color-wordpressOrg}; | ||
--color-email: #f8f8f8; | ||
--color-email-rgb: #{hex-to-rgb( #f8f8f8 )}; |
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.
We don't need any of these rgb variables
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.
Removed. 👍
client/my-sites/sharing/style.scss
Outdated
@include sharing-button-service( 'skype', $color-skype ); | ||
@include sharing-button-service( 'telegram', $color-telegram ); | ||
@include sharing-button-service( 'jetpack-whatsapp', $color-whatsapp ); | ||
@include sharing-button-service( 'facebook', var( --color-facebook-rgb )); |
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.
Edit: sorry, instead of removing these references, let's simplify the mixin found here:
wp-calypso/client/my-sites/sharing/style.scss
Line 897 in 2d50a28
&:hover { |
To just be:
@mixin sharing-button-service( $name, $color ) {
.sharing-buttons-preview-button.style-icon.share-#{ $name } {
background: $color;
&:hover {
background: $color;
}
}
}
By doing that, you won't need any rgb variables.
@torres126 List of changes:
I believe that is what needs to be done. After that, we can wait for a final review from a developer. Thanks! |
Thanks @drw158! I just added two commits to address this, do they help deal with this? |
client/my-sites/sharing/style.scss
Outdated
@include sharing-button-service( 'facebook', var( --color-facebook )); | ||
@include sharing-button-service( 'twitter', var( --color-twitter )); | ||
@include sharing-button-service( 'press-this', var( --color-wpcom )); | ||
@include sharing-button-service( 'path', var( --color-path-rgb )); |
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.
Seems to be an rgb here?
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.
Oops, removed.
Sidenote: I've not checked if it's used across Calypso yet, but does Path even need to be included at all? It closed down a while ago (see #27252).
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.
The color is still being used here
color: $color-path; |
But I don't think it's an option anymore, so probably fine to remove
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.
What a PR! Thanks for working on this @torres126 , it's highly appreciated 👍 let's ship this now
Thanks @flootr! :) |
Changes proposed in this Pull Request
Follow up to #30055, this PR will update external brand colours (all but Jetpack and WP) with variables. There should be no visual changes.
Edit: Also take the opportunity to remove Path colours, since it closed down last year and is no longer used throughout Calypso (see #27252)
Testing instructions
Is everything valid? Were any typos made (eg. with HEX codes)? Are there any remaining variables which need to be changed but haven't be touched yet?