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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 17 additions & 18 deletions assets/stylesheets/shared/_color-schemes.scss
Original file line number Diff line number Diff line change
Expand Up @@ -217,24 +217,23 @@

--color-wpcom: #{$muriel-blue-500};
--color-jetpack: #{$green-jetpack};
--color-facebook: #{$color-facebook};
--color-twitter: #{$color-twitter};
--color-gplus: #{$color-gplus};
--color-tumblr: #{$color-tumblr};
--color-linkedin: #{$color-linkedin};
--color-path: #{$color-path};
--color-instagram: #{$color-instagram};
--color-eventbrite: #{$color-eventbrite};
--color-stumbleupon: #{$color-stumbleupon};
--color-reddit: #{$color-reddit};
--color-pinterest: #{$color-pinterest};
--color-pocket: #{$color-pocket};
--color-email: #{$color-email};
--color-print: #{$color-print};
--color-skype: #{$color-skype};
--color-telegram: #{$color-telegram};
--color-whatsapp: #{$color-whatsapp};
--color-wordpress-org: #{$color-wordpressOrg};
--color-email: #f8f8f8;
--color-eventbrite: #ff8000;
--color-facebook: #39579a;
--color-gplus: #df4a32;
--color-instagram: #d93174;
--color-linkedin: #0976b4;
--color-pinterest: #cc2127;
--color-pocket: #ee4256;
--color-print: #f8f8f8;
--color-reddit: #5f99cf;
--color-skype: #00aff0;
--color-stumbleupon: #eb4924;
--color-telegram: #0088cc;
--color-tumblr: #35465c;
--color-twitter: #55acee;
--color-whatsapp: #43d854;
--color-wordpress-org: #585c60;

--color-section-nav-item-background-hover: #{$muriel-blue-0};
--color-themes-active-text: #{$muriel-blue-0};
Expand Down
20 changes: 0 additions & 20 deletions assets/stylesheets/shared/_colors.scss
Original file line number Diff line number Diff line change
Expand Up @@ -63,23 +63,3 @@ $masterbar-color: $blue-wordpress;
$sidebar-bg-color: $gray-lighten-30;
$sidebar-text-color: $gray-dark;
$sidebar-selected-color: $gray-text-min;

//Social media colors
$color-facebook: #39579a;
$color-twitter: #55acee;
$color-gplus: #df4a32;
$color-tumblr: #35465c;
$color-linkedin: #0976b4;
$color-path: #df3b2f;
$color-instagram: #d93174;
$color-eventbrite: #ff8000;
$color-stumbleupon: #eb4924;
$color-reddit: #5f99cf;
$color-pinterest: #cc2127;
$color-pocket: #ee4256;
$color-email: #f8f8f8;
$color-print: #f8f8f8;
$color-skype: #00aff0;
$color-telegram: #0088cc;
$color-whatsapp: #43d854;
$color-wordpressOrg: #585c60;
16 changes: 6 additions & 10 deletions client/blocks/post-share/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -218,31 +218,27 @@ $section-border: solid 1px darken( $sidebar-bg-color, 5% );
.post-share__service.is-active,
.post-share__handle {
.social-logo.twitter {
color: $color-twitter;
color: var( --color-twitter );
}

.social-logo.facebook {
color: $color-facebook;
color: var( --color-facebook );
}

.social-logo.google-plus {
color: $color-gplus;
color: var( --color-gplus );
}

.social-logo.linkedin {
color: $color-linkedin;
color: var( --color-linkedin );
}

.social-logo.tumblr {
color: $color-tumblr;
}

.social-logo.path {
color: $color-path;
color: var( --color-tumblr );
}

.social-logo.eventbrite {
color: $color-eventbrite;
color: var( --color-eventbrite );
}

.post-share__service-account-image::after {
Expand Down
4 changes: 2 additions & 2 deletions client/blocks/reader-share/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@
}

.social-logo.twitter {
fill: #2aa9e0;
fill: var( --color-twitter );
}

.social-logo.facebook {
fill: #3b5998;
fill: var( --color-facebook );
}

&:hover,
Expand Down
16 changes: 8 additions & 8 deletions client/components/share-button/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,34 @@
}

.facebook {
fill: $color-facebook;
fill: var( --color-facebook );
}

.twitter {
fill: $color-twitter;
fill: var( --color-twitter );
}

.google-plus {
fill: $color-gplus;
fill: var( --color-gplus );
}

.tumblr {
fill: $color-tumblr;
fill: var( --color-tumblr );
}

.linkedin {
fill: $color-linkedin;
fill: var( --color-linkedin );
}

.pinterest {
fill: $color-pinterest;
fill: var( --color-pinterest );
}

.telegram {
fill: $color-telegram;
fill: var( --color-telegram );
}

.whatsapp {
fill: $color-whatsapp;
fill: var( --color-whatsapp );
}
}
12 changes: 6 additions & 6 deletions client/extensions/woocommerce/components/share-widget/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,26 +32,26 @@

.share-widget__service .social-logo {
&.facebook {
color: $color-facebook;
color: var( --color-facebook );
}

&.twitter {
color: $color-twitter;
color: var( --color-twitter );
}

&.google-plus {
color: $color-gplus;
color: var( --color-gplus );
}

&.linkedin {
color: $color-linkedin;
color: var( --color-linkedin );
}

&.tumblr {
color: $color-tumblr;
color: var( --color-tumblr );
}

&.pinterest {
color: $color-pinterest;
color: var( --color-pinterest );
}
}
10 changes: 5 additions & 5 deletions client/gutenberg/extensions/publicize/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,19 @@ $dark-gray-500: #555d66;
margin-right: 5px;

&.is-facebook {
fill: #3957a2;
fill: var( --color-facebook );
}
&.is-twitter {
fill: #55acee;
fill: var( --color-twitter );
}
&.is-linkedin {
fill: #0976b4;
fill: var( --color-linkedin );
}
&.is-tumblr {
fill: #35465c;
fill: var( --color-tumblr );
}
&.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.

}
}

Expand Down
2 changes: 1 addition & 1 deletion client/my-sites/activity/activity-log-item/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@

.social-logo {
fill: var( --color-white );
background: $color-wordpressOrg;
background: var( --color-wordpress-org );
border-radius: 50%;
}

Expand Down
66 changes: 32 additions & 34 deletions client/my-sites/sharing/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,49 +9,49 @@
&.facebook {
h2,
.sharing-service__logo {
color: $color-facebook;
color: var( --color-facebook );
}
}

&.twitter {
h2,
.sharing-service__logo {
color: $color-twitter;
color: var( --color-twitter );
}
}

&.google_plus {
h2,
.sharing-service__logo {
color: $color-gplus;
color: var( --color-gplus );
}
}

&.linkedin {
h2,
.sharing-service__logo {
color: $color-linkedin;
color: var( --color-linkedin );
}
}

&.tumblr {
h2,
.sharing-service__logo {
color: $color-tumblr;
color: var( --color-tumblr );
}
}

&.eventbrite {
h2,
.sharing-service__logo {
color: $color-eventbrite;
color: var( --color-eventbrite );
}
}

&.instagram {
h2,
.sharing-service__logo {
color: $color-instagram;
color: var( --color-instagram );
}
}

Expand Down Expand Up @@ -264,14 +264,13 @@
}
}

@include sharing-service( 'facebook', $color-facebook );
@include sharing-service( 'twitter', $color-twitter );
@include sharing-service( 'google_plus', $color-gplus );
@include sharing-service( 'tumblr', $color-tumblr );
@include sharing-service( 'linkedin', $color-linkedin );
@include sharing-service( 'path', $color-path );
@include sharing-service( 'instagram', $color-instagram );
@include sharing-service( 'eventbrite', $color-eventbrite );
@include sharing-service( 'facebook', var( --color-facebook ));
@include sharing-service( 'twitter', var( --color-twitter ));
@include sharing-service( 'google_plus', var( --color-gplus ));
@include sharing-service( 'tumblr', var( --color-tumblr ));
@include sharing-service( 'linkedin', var( --color-linkedin ));
@include sharing-service( 'instagram', var( --color-instagram ));
@include sharing-service( 'eventbrite', var( --color-eventbrite ));

.sharing-service__name {
clear: none;
Expand Down Expand Up @@ -895,29 +894,28 @@
background: $color;

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

@include sharing-button-service( 'facebook', $color-facebook );
@include sharing-button-service( 'twitter', $color-twitter );
@include sharing-button-service( 'press-this', $blue-wordpress );
@include sharing-button-service( 'path', $color-path );
@include sharing-button-service( 'google-plus-1', $color-gplus );
@include sharing-button-service( 'instagram', $color-instagram );
@include sharing-button-service( 'eventbrite', $color-eventbrite );
@include sharing-button-service( 'linkedin', $color-linkedin );
@include sharing-button-service( 'stumbleupon', $color-stumbleupon );
@include sharing-button-service( 'tumblr', $color-tumblr );
@include sharing-button-service( 'reddit', $color-reddit );
@include sharing-button-service( 'pinterest', $color-pinterest );
@include sharing-button-service( 'pocket', $color-pocket );
@include sharing-button-service( 'email', $color-email );
@include sharing-button-service( 'print', $color-print );
@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 ));
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.

@include sharing-button-service( 'twitter', var( --color-twitter ));
@include sharing-button-service( 'press-this', var( --color-wpcom ));
@include sharing-button-service( 'google-plus-1', var( --color-gplus ));
@include sharing-button-service( 'instagram', var( --color-instagram ));
@include sharing-button-service( 'eventbrite', var( --color-eventbrite ));
@include sharing-button-service( 'linkedin', var( --color-linkedin ));
@include sharing-button-service( 'stumbleupon', var( --color-stumbleupon ));
@include sharing-button-service( 'tumblr', var( --color-tumblr ));
@include sharing-button-service( 'reddit', var( --color-reddit ));
@include sharing-button-service( 'pinterest', var( --color-pinterest ));
@include sharing-button-service( 'pocket', var( --color-pocket ));
@include sharing-button-service( 'email', var( --color-email ));
@include sharing-button-service( 'print', var( --color-print ));
@include sharing-button-service( 'skype', var( --color-skype ));
@include sharing-button-service( 'telegram', var( --color-telegram ));
@include sharing-button-service( 'jetpack-whatsapp', var( --color-whatsapp ));

.sharing-buttons-preview__panel {
position: relative;
Expand Down