Skip to content
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

Merged
merged 21 commits into from
Jan 18, 2019

Conversation

Aurorum
Copy link
Contributor

@Aurorum Aurorum commented Jan 10, 2019

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?

@Aurorum
Copy link
Contributor Author

Aurorum commented Jan 10, 2019

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 );
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that these use HEX codes...is there a specific reason why? I'm assuming it can just be set to variables too.
(cc @floor, @blowery, @drw158)

Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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.

@flootr flootr added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Jan 11, 2019
@flootr flootr requested a review from a team January 11, 2019 07:05
@@ -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 ));
Copy link
Contributor

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.

Copy link
Contributor Author

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?

Suggested change
@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.

Copy link
Contributor

@flootr flootr Jan 16, 2019

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:

&:hover {
background: rgba( $color, 0.9 );
}

and the above rgba function doesn't work with hex values

Copy link
Contributor Author

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 )};

Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor

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.

Copy link
Contributor

@flootr flootr left a 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 👍

@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 );
Copy link
Contributor

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?

Copy link
Contributor Author

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. :)

Copy link
Contributor

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?

Copy link
Contributor

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.

@davewhitley davewhitley self-assigned this Jan 17, 2019
@davewhitley
Copy link
Contributor

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

&:hover {
background: rgba( $color, 0.9 );
}

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:

screen shot 2019-01-17 at 10 16 50 am

@Aurorum
Copy link
Contributor Author

Aurorum commented Jan 17, 2019

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 )};
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed. 👍

@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 ));
Copy link
Contributor

@davewhitley davewhitley Jan 17, 2019

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:

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.

@davewhitley
Copy link
Contributor

davewhitley commented Jan 17, 2019

@torres126 List of changes:

  1. Simplify this mixin so that it doesn't need rgb: See my comment here
  2. Get rid of the rgb variables

I believe that is what needs to be done. After that, we can wait for a final review from a developer. Thanks!

@davewhitley davewhitley removed their assignment Jan 17, 2019
@Aurorum
Copy link
Contributor Author

Aurorum commented Jan 17, 2019

Thanks @drw158! I just added two commits to address this, do they help deal with this?

@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 ));
Copy link
Contributor

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?

Copy link
Contributor Author

@Aurorum Aurorum Jan 17, 2019

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).

Copy link
Contributor

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

But I don't think it's an option anymore, so probably fine to remove

screen shot 2019-01-17 at 1 38 55 pm

Copy link
Contributor

@flootr flootr left a 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

@flootr flootr added [Status] Ready to Merge and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Jan 18, 2019
@flootr flootr merged commit a71dec9 into Automattic:master Jan 18, 2019
@Aurorum
Copy link
Contributor Author

Aurorum commented Jan 18, 2019

Thanks @flootr! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants