Skip to content

Switches the default logo color depending on the primary color - #10898

Merged
MorrisJobke merged 6 commits into
masterfrom
feature/10684/default-logo-color-theme-colors
Oct 8, 2018
Merged

Switches the default logo color depending on the primary color#10898
MorrisJobke merged 6 commits into
masterfrom
feature/10684/default-logo-color-theme-colors

Conversation

@weeman1337

Copy link
Copy Markdown
Member

These changes add switching the default logo from white to blue depending on the primary color.
The switch happens between #cccccc and #dddddd

image

image

A custom logo doesn't use this mechanism.

Closes#10684

Comment threadcore/img/logo-blue.svg Outdated
@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I added the blue versions and didn't use the svg api, because it may not be available e.g. on the guest page.
There was another issue also taking out some icons for that reason.

@weeman1337weeman1337 added design Design, UI, UX, etc. 3. to review Waiting for reviews labels Aug 28, 2018
@jancborchardt

Copy link
Copy Markdown
Member

@weeman1337 cool! I will come over to you in a bit :) Meanwhile – what would happen, say, when you have a light yellow or green theming color? Cause then the logo color would clash, right? That's why I would make it dark instead of blue, just like the top bar icons.

@weeman1337

Copy link
Copy Markdown
MemberAuthor

@jancborchardt I made it blue because of #10684 (comment)

We had some discussion about that in the past, and the conclusion was that we don't want to invert the logo, because the Nextcloud logo should either be blue or white.

@weeman1337

Copy link
Copy Markdown
MemberAuthor

@skjnldsv I moved the logos to img/logo and started using the SVG API as suggested.
Let's see what the build says..

@jancborchardt

Copy link
Copy Markdown
Member

So @weeman1337 and me just looked at it and we just have to pick a tradeoff:

  1. Logo always ⚪ white: Looks bad as soon as the color is light and all icons are dark
  2. Logo ⚪ white on dark background, and 🔵 blue on light background: Looks really bad on any light color which is not grey.
  3. Logo ⚪ white on dark background, and ⚫ black on light background: Looks decent.

So we are going for option 3. cc for info @nextcloud/designers

Only thing to adjust is that the threshold for change is the same as for the app icons in the top bar. :) Then 👍 from me.

@MorrisJobkeMorrisJobke added this to the Nextcloud 15 milestone Aug 28, 2018
@MorrisJobke

Copy link
Copy Markdown
Member

Please wait for the stable14 branch until merging. I would like to not merge this into 14 that short before a release.

@weeman1337

Copy link
Copy Markdown
MemberAuthor

After a short discussion I updated it to work like the app icons. Looks quite nice:
image

@skjnldsvskjnldsv left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good stuff :)
Some small nitpicks ;)

Comment threadapps/theming/css/theming.scss Outdated

@if ($has-custom-logo == false) {
@if ($invert) {
$image-logo: url('../../../../svg/core/logo/logo/000000?v=1');

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please use the scss function for that :)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@mixinicon-color($icon, $dir, $color, $version: 1, $core: false) {
// remove # from color
// inspect cast int to string
$index: str-index(inspect($color), '#');
@if$index {
$color: str-slice(inspect($color), 2);
}
$varName: "--icon-#{$icon}-#{$color}";
@if$core {
#{$varName}: url('#{$webroot}/svg/core/#{$dir}/#{$icon}/#{$color}?v=#{$version}');
} @else {
#{$varName}: url('#{$webroot}/svg/#{$dir}/#{$icon}/#{$color}?v=#{$version}');
}
background-image: var(#{$varName});
}

Comment threadcore/img/logo/logo.svg Outdated
@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why this change of the logo file? :)

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I just removed the grouping of the three circles. The svg coloring freaked out..

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you clean things up then? :)
We use scour ;)

scour --create-groups --enable-id-stripping --enable-comment-stripping --shorten-ids --remove-metadata --strip-xml-prolog --no-line-breaks -i old.svg new.svg

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

done

Comment threadcore/Controller/SvgController.php Outdated
// add fill (fill is not present on black elements)
$fillRe = '/<((circle|rect|path)((?!fill)[a-z0-9 =".\-#():;])+)\/>/mi';

$fillRe = '/<((circle|rect|path)((!fill)[a-z0-9 =".\-#():;])+)\/>/mi';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If you change the regex, please update the tests to make sure we also cover the reason why you changed this ;)

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I'll add a test!
It changes the regex to do what the comment says ;) The actual version replaces existing fills. Removing the ? only matches if there isn't a fill already.

@juliusknorrjuliusknorr added 2. developing Work in progress and removed 3. to review Waiting for reviews labels Aug 30, 2018
@weeman1337
weeman1337force-pushed the feature/10684/default-logo-color-theme-colors branch from 7210b11 to 0576f82CompareAugust 30, 2018 19:09
@weeman1337

Copy link
Copy Markdown
MemberAuthor

@skjnldsv I added a SvgControllerTest. The SVG coloring has some pitfalls. E.g. applying it on a black circle (without stroke/fill) or a group (applying it to child elements) may result in unwanted filled elements. I tweaked the Nextcloud logo to work.

With the new test we may extend the behavior in the future.

* @returns string the url to the svg api endpoint
* @returns A background image with the url to the set to the requested icon.
*/
@mixin icon-color($icon, $dir, $color, $version: 1, $core: false) {

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I took this apart, because it didn't do what the comment said...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thx!

@skjnldsv

Copy link
Copy Markdown
Member

With the new test we may extend the behavior in the future.

Maybe we should enforce a fill attribute and only replace in the future :)

@suntorytimed

Copy link
Copy Markdown
Contributor

Could this be implemented for the favicon as well? Would be nice to have a favicon that corresponds to the primary color and the different color of the Nextcloud logo. Currently it is necessary to use imagmagick to do any changes to the favicon.

@skjnldsv

Copy link
Copy Markdown
Member

@suntorytimed unfortunately, no. Svg as favicon are nowhere near to be supported: https://caniuse.com/#feat=link-icon-svg

@weeman1337
weeman1337force-pushed the feature/10684/default-logo-color-theme-colors branch from 0576f82 to d1478a9CompareSeptember 6, 2018 17:45
@weeman1337weeman1337 added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Sep 22, 2018
Signed-off-by: Michael Weimann <mail@michael-weimann.eu>
Signed-off-by: Michael Weimann <mail@michael-weimann.eu>
Signed-off-by: Michael Weimann <mail@michael-weimann.eu>
Signed-off-by: Michael Weimann <mail@michael-weimann.eu>
@rullzer
rullzerforce-pushed the feature/10684/default-logo-color-theme-colors branch from d1478a9 to a45ec3dCompareOctober 2, 2018 06:38
@rullzer

Copy link
Copy Markdown
Member

Rebased

@skjnldsvskjnldsv left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Code looks good! Let's wait the input of our lord and master @juliushaertl 😉

@juliusknorr

Copy link
Copy Markdown
Member

@weeman1337 There is one test failing:

There was 1 failure:
1) OCA\Theming\Tests\UtilTest::testGetAppImage with data set #0 ('core', 'logo.svg', '/drone/src/github.com/nextclo...go.svg')
Failed asserting that false matches expected '/drone/src/github.com/nextcloud/server/core/img/logo.svg'.
/drone/src/github.com/nextcloud/server/apps/theming/tests/UtilTest.php:172

Besides that it looks good to me, the favicon could also use the inverted logo, as we generate a png from with imagemagick for that anyway, but we can do that in a follow up pr.

@MorrisJobkeMorrisJobke added 2. developing Work in progress and removed 3. to review Waiting for reviews labels Oct 2, 2018

@jancborchardtjancborchardt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice, looking good! 👍

And yes, @juliushaertl follow-up PR to adjust the favicon would be great! :)

Signed-off-by: Michael Weimann <mail@michael-weimann.eu>
@MorrisJobke

Copy link
Copy Markdown
Member

@weeman1337 Tests still fail 😢

Signed-off-by: Michael Weimann <mail@michael-weimann.eu>
@weeman1337weeman1337 added 4. to release Ready to be released and/or waiting for tests to finish and removed 2. developing Work in progress labels Oct 4, 2018
@MorrisJobke
MorrisJobke merged commit 7971ba5 into masterOct 8, 2018
@MorrisJobke
MorrisJobke deleted the feature/10684/default-logo-color-theme-colors branch October 8, 2018 08:33
@MorrisJobkeMorrisJobke mentioned this pull request Dec 6, 2018
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4. to releaseReady to be released and/or waiting for tests to finishdesignDesign, UI, UX, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@weeman1337@jancborchardt@MorrisJobke@skjnldsv@suntorytimed@rullzer@juliusknorr