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

gitea png to logo #13974

Merged
merged 7 commits into from
Dec 19, 2020
Merged

Conversation

kdumontnu
Copy link
Contributor

@kdumontnu kdumontnu commented Dec 13, 2020

Closes #13969

More general usage for logo png files to make it easier for users to customize logo.

Users should now be able to replace the file logo.svg with a custom svg logo and run make generate-images to update the logo (no need to change the templates).

Note: I've kept gitea.svg and gitea-192.png for use in locations that should retain the gitea logo even after the fork logo is updated, such as the README files and webhook html templates. To regenerate these images, run TAGS="gitea" make generate-images.

Edit: After some discussion (see below), I've also updated most html template references to logo.svg instead of png.

@codecov-io
Copy link

codecov-io commented Dec 13, 2020

Codecov Report

❗ No coverage uploaded for pull request base (master@e25e7b9). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master   #13974   +/-   ##
=========================================
  Coverage          ?   42.26%           
=========================================
  Files             ?      726           
  Lines             ?    77684           
  Branches          ?        0           
=========================================
  Hits              ?    32830           
  Misses            ?    39479           
  Partials          ?     5375           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e25e7b9...dac624a. Read the comment docs.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Dec 13, 2020
@6543 6543 added the type/refactoring Existing code has been cleaned up. There should be no new functionality. label Dec 14, 2020
@6543 6543 added this to the 1.14.0 milestone Dec 14, 2020
@6543 6543 added the pr/breaking Merging this PR means builds will break. Needs a description what exactly breaks, and how to fix it! label Dec 14, 2020
@6543
Copy link
Member

6543 commented Dec 14, 2020

It's kind breaking since lot of sites have customized there logo and have to change the path if merged ...

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Dec 14, 2020
Copy link
Member

@lunny lunny left a comment

Choose a reason for hiding this comment

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

I don't think this is necessary. You can change the customized template to use your own logo.

@kdumontnu
Copy link
Contributor Author

@6543 Yes, this is likely a breaking change

@lunny This simplifies the process and reduces the number of upstream conflicts in new forked projects. The idea here is twofold:

  1. Users don't need to modify each template that references a logo file. They can now just replace the logo pngs or simply change assets/logo.svg and run make generate-images.
  2. It keeps a separate gitea logo file for places in template that should keep the gitea image even when the main logo is updated (ex. webhooks)

I'll leave it up to you and the rest of the maintainers whether a potentially breaking change for existing forks is worth it to reduce the number of breaking changes in future forks. I think so, but happy to close the PR if the team sees otherwise 👍

Copy link
Member

@techknowlogick techknowlogick left a comment

Choose a reason for hiding this comment

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

Thanks for PR :)

Blocking until #13680 is merged due to potential merge conflicts that will arise from both PRs.

@kdumontnu
Copy link
Contributor Author

Thanks for PR :)

Blocking until #13680 is merged due to potential merge conflicts that will arise from both PRs.

K, I can rebase when that gets merged.

One solution to avoid the breaking change is to keep the gitea-X.png files as they are, change the generate-images script and templates to logo-X.png, add generate-images to make build, but don't commit the logo-X.png files (not sure why we would commit these anyways).

This way, anyone referencing gitea-X.png will still have access. It's a bit more involved change and would likely require a new CI test though.

@silverwind
Copy link
Member

Rename is a good idea but I wonder if we can cut down the amount of different sizes. We could use SVG in HTML exclusively and it would be consistent with the favicon which we requires as SVG already.

It would get harder to use raster images for customization but apparently it's not impossible to embed them in SVG and with the favicon already changed, we have already committed to requiring a vector image.

@kdumontnu
Copy link
Contributor Author

kdumontnu commented Dec 14, 2020

Rename is a good idea but I wonder if we can cut down the amount of different sizes. We could use SVG in HTML exclusively and it would be consistent with the favicon which we requires as SVG already.

It would get harder to use raster images for customization but apparently it's not impossible to embed them in SVG and with the favicon already changed, we have already committed to requiring a vector image.

+1 to svg, I'll likely use svg in my fork. If this is the accepted solution I'm happy to make this change. I would leave gitea-sm.png and gitea-lg.png so that we can reference them in the README (until gitea supports svg 😄). Unless I hear otherwise, this is the direction I'll take it (@techknowlogick).

The only place 512 and 192 are referenced is pwa/manifest_json.tmpl, which I know very little about. Although apparently they support svgs with "sizes": "any".
edit: except on Chrome 🙄 well, I think we should be able to still use "sizes": "48x48 72x72 96x96 128x128 256x256"

@silverwind
Copy link
Member

silverwind commented Dec 14, 2020

Full conversation to SVG will need more consideration and testing, I guess we can do it another time. I think the primary blockers are mobile browsers which use the PNGs for the homescreen icon. I can't find any definitive info on SVG support for those but I'd expect some issues.

For example Chrome devtools can not deal with any:

https://bugs.chromium.org/p/chromium/issues/detail?id=1107123

@kdumontnu
Copy link
Contributor Author

Full conversation to SVG will need more consideration and testing, I guess we can do it another time. I think the primary blockers are mobile browsers which use the PNGs for the homescreen icon. I can't find any definitive info on SVG support for those but I'd expect some issues.

For example Chrome devtools can not deal with any:

https://bugs.chromium.org/p/chromium/issues/detail?id=1107123

I can at least update all of the template html references to svg and leave the manifest alone for now. It resolves my concern and removes a future breaking change.

@silverwind
Copy link
Member

Yeah, HTML is always fine to update.

@silverwind
Copy link
Member

I think fluid-icon can also be removed if we can confirm that Firefox will use the SVG favicon.

https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/UI_considerations#How_an_icon_is_selected

Copy link
Member

@techknowlogick techknowlogick left a comment

Choose a reason for hiding this comment

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

Dismissing my blocking review.

Thanks for this PR :)

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Dec 18, 2020
templates/base/head.tmpl Outdated Show resolved Hide resolved
@kdumontnu kdumontnu force-pushed the kd/standard_logo_name branch from 82a81b9 to 7623ac0 Compare December 18, 2020 05:01
@kdumontnu
Copy link
Contributor Author

Dismissing my blocking review.

Thanks for this PR :)

@techknowlogick You're very welcome. I've made some significant changes and rebased since you approved - can you take another look?

@kdumontnu kdumontnu requested a review from lunny December 18, 2020 05:28
@lunny
Copy link
Member

lunny commented Dec 18, 2020

CI failed seems unrelated.

public/img/gitea.svg Outdated Show resolved Hide resolved
Makefile Show resolved Hide resolved
@kdumontnu
Copy link
Contributor Author

This PR should be all set to merge 👍

@techknowlogick techknowlogick merged commit 4cd94e3 into go-gitea:master Dec 19, 2020
@techknowlogick
Copy link
Member

Thanks again :)

@silverwind
Copy link
Member

silverwind commented Dec 19, 2020

As a next step, I think we should reduce the logos in use further, there is no reason to fetch logo.svg and favicon.svg, they are essentially the same resource. We can combine them into a 32px SVG logo.svg

Dimensions shouldn't matter for a SVG file but I recall keeping it at 32px for possible compatibilty for favicons.

Also, we can possible cut down on the number of PNGs.

@kdumontnu
Copy link
Contributor Author

@silverwind
Copy link
Member

silverwind commented Dec 24, 2020

Yeah, seen it. I disagree about the .ico thought, it's just unnecessary, PNG/SVG covers everything.

Followup PR: #14136

@kdumontnu kdumontnu deleted the kd/standard_logo_name branch December 27, 2020 18:13
@go-gitea go-gitea locked and limited conversation to collaborators Feb 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. pr/breaking Merging this PR means builds will break. Needs a description what exactly breaks, and how to fix it! type/refactoring Existing code has been cleaned up. There should be no new functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Simpler Custom Logo Workflow
9 participants