diff --git a/README.md b/README.md index 95717a50bd..8fd3f5f606 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,52 @@ -[简体中文](README_ZH.md) +

+ + Gitea + +

+

Gitea - Git with a cup of tea

-

logo Gitea - Git with a cup of tea

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

-[![Build Status](https://drone.gitea.io/api/badges/go-gitea/gitea/status.svg?ref=refs/heads/master)](https://drone.gitea.io/go-gitea/gitea) -[![Join the Discord chat at https://discord.gg/Gitea](https://img.shields.io/discord/322538954119184384.svg)](https://discord.gg/Gitea) -[![](https://images.microbadger.com/badges/image/gitea/gitea.svg)](https://microbadger.com/images/gitea/gitea "Get your own image badge on microbadger.com") -[![codecov](https://codecov.io/gh/go-gitea/gitea/branch/master/graph/badge.svg)](https://codecov.io/gh/go-gitea/gitea) -[![Go Report Card](https://goreportcard.com/badge/code.gitea.io/gitea)](https://goreportcard.com/report/code.gitea.io/gitea) -[![GoDoc](https://godoc.org/code.gitea.io/gitea?status.svg)](https://godoc.org/code.gitea.io/gitea) -[![GitHub release](https://img.shields.io/github/release/go-gitea/gitea.svg)](https://github.com/go-gitea/gitea/releases/latest) -[![Help Contribute to Open Source](https://www.codetriage.com/go-gitea/gitea/badges/users.svg)](https://www.codetriage.com/go-gitea/gitea) -[![Become a backer/sponsor of gitea](https://opencollective.com/gitea/tiers/backers/badge.svg?label=backers&color=brightgreen)](https://opencollective.com/gitea) -[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) -[![Crowdin](https://badges.crowdin.net/gitea/localized.svg)](https://crowdin.com/project/gitea) -[![TODOs](https://badgen.net/https/api.tickgit.com/badgen/github.com/go-gitea/gitea)](https://www.tickgit.com/browse?repo=github.com/go-gitea/gitea) +

+ View the chinese version of this document +

## Purpose diff --git a/README_ZH.md b/README_ZH.md index 5163e336d2..cb3c7d64b7 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -1,18 +1,52 @@ -[English](README.md) +

+ + Gitea + +

+

Gitea - Git with a cup of tea

-

logo Gitea - Git with a cup of tea

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

-[![Build Status](https://drone.gitea.io/api/badges/go-gitea/gitea/status.svg)](https://drone.gitea.io/go-gitea/gitea) -[![Join the Discord chat at https://discord.gg/Gitea](https://img.shields.io/discord/322538954119184384.svg)](https://discord.gg/Gitea) -[![](https://images.microbadger.com/badges/image/gitea/gitea.svg)](https://microbadger.com/images/gitea/gitea "Get your own image badge on microbadger.com") -[![codecov](https://codecov.io/gh/go-gitea/gitea/branch/master/graph/badge.svg)](https://codecov.io/gh/go-gitea/gitea) -[![Go Report Card](https://goreportcard.com/badge/code.gitea.io/gitea)](https://goreportcard.com/report/code.gitea.io/gitea) -[![GoDoc](https://godoc.org/code.gitea.io/gitea?status.svg)](https://godoc.org/code.gitea.io/gitea) -[![GitHub release](https://img.shields.io/github/release/go-gitea/gitea.svg)](https://github.com/go-gitea/gitea/releases/latest) -[![Help Contribute to Open Source](https://www.codetriage.com/go-gitea/gitea/badges/users.svg)](https://www.codetriage.com/go-gitea/gitea) -[![Become a backer/sponsor of gitea](https://opencollective.com/gitea/tiers/backers/badge.svg?label=backers&color=brightgreen)](https://opencollective.com/gitea) -[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) -[![Crowdin](https://badges.crowdin.net/gitea/localized.svg)](https://crowdin.com/project/gitea) +

+ View the english version of this document +

## 目标 diff --git a/build/generate-images.js b/build/generate-images.js index 9bd40641e4..c9108ce713 100755 --- a/build/generate-images.js +++ b/build/generate-images.js @@ -2,10 +2,10 @@ 'use strict'; const imageminZopfli = require('imagemin-zopfli'); +const Svgo = require('svgo'); const {fabric} = require('fabric'); const {readFile, writeFile} = require('fs').promises; const {resolve} = require('path'); -const Svgo = require('svgo'); const logoFile = resolve(__dirname, '../assets/logo.svg'); @@ -22,32 +22,20 @@ function loadSvg(svg) { }); } -async function generateSvgFavicon(svg, outputFile) { - const svgo = new Svgo({ - plugins: [ - {removeDimensions: true}, - { - addAttributesToSVGElement: { - attributes: [ - {'width': '32'}, - {'height': '32'}, - ], - }, - }, - ], - }); - - const {data} = await svgo.optimize(svg); - await writeFile(outputFile, data); -} - -async function generateSvg(svg, outputFile) { - const svgo = new Svgo(); - const {data} = await svgo.optimize(svg); - await writeFile(outputFile, data); -} - async function generate(svg, outputFile, {size, bg}) { + if (outputFile.endsWith('.svg')) { + const svgo = new Svgo({ + plugins: [ + {removeDimensions: true}, + {addAttributesToSVGElement: {attributes: [{width: size}, {height: size}]}}, + ], + }); + + const {data} = await svgo.optimize(svg); + await writeFile(outputFile, data); + return; + } + const {objects, options} = await loadSvg(svg); const canvas = new fabric.Canvas(); canvas.setDimensions({width: size, height: size}); @@ -78,25 +66,16 @@ async function generate(svg, outputFile, {size, bg}) { async function main() { const gitea = process.argv.slice(2).includes('gitea'); - const svg = await readFile(logoFile, 'utf8'); + await Promise.all([ - generateSvgFavicon(svg, resolve(__dirname, '../public/img/favicon.svg')), - generateSvg(svg, resolve(__dirname, '../public/img/logo.svg')), - generate(svg, resolve(__dirname, '../public/img/logo-lg.png'), {size: 880}), - generate(svg, resolve(__dirname, '../public/img/logo-512.png'), {size: 512}), - generate(svg, resolve(__dirname, '../public/img/logo-192.png'), {size: 192}), - generate(svg, resolve(__dirname, '../public/img/logo-sm.png'), {size: 120}), - generate(svg, resolve(__dirname, '../public/img/avatar_default.png'), {size: 200}), + generate(svg, resolve(__dirname, '../public/img/logo.svg'), {size: 32}), + generate(svg, resolve(__dirname, '../public/img/logo.png'), {size: 512}), generate(svg, resolve(__dirname, '../public/img/favicon.png'), {size: 180}), + generate(svg, resolve(__dirname, '../public/img/avatar_default.png'), {size: 200}), generate(svg, resolve(__dirname, '../public/img/apple-touch-icon.png'), {size: 180, bg: true}), + gitea && generate(svg, resolve(__dirname, '../public/img/gitea.svg'), {size: 32}), ]); - if (gitea) { - await Promise.all([ - generateSvg(svg, resolve(__dirname, '../public/img/gitea.svg')), - generate(svg, resolve(__dirname, '../public/img/gitea-192.png'), {size: 192}), - ]); - } } main().then(exit).catch(exit); diff --git a/docs/content/doc/advanced/customizing-gitea.en-us.md b/docs/content/doc/advanced/customizing-gitea.en-us.md index be6512a450..9f1a43c017 100644 --- a/docs/content/doc/advanced/customizing-gitea.en-us.md +++ b/docs/content/doc/advanced/customizing-gitea.en-us.md @@ -59,11 +59,20 @@ the url `http://gitea.domain.tld/image.png`. ## Changing the default logo -To automatically update custom logo png and svg files replace `assets/logo.svg` and run `make generate-images`. This will update the user-designated logo files served in `public/img`. Alternatively, you can manually update each `logo-X.png` and `logo.svg` file in `public/img`. +To build a custom logo replace `assets/logo.svg` and run `make generate-images`. This will update +these customizable logo files which you can then place in `custom/public/img` on your server: + +- `public/img/logo.svg` +- `public/img/logo.png` +- `public/img/favicon.png` +- `public/img/avatar_default.png` +- `public/img/apple-touch-icon.png` ## Changing the default avatar -Place the png image at the following path: `custom/public/img/avatar_default.png` +Either generate it via above method or place the png image at the following path: + +- `custom/public/img/avatar_default.png` ## Customizing Gitea pages and resources diff --git a/modules/setting/setting.go b/modules/setting/setting.go index 8a4d7acc4d..a98a97950b 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -1089,24 +1089,14 @@ func MakeManifestData(appName string, appURL string, absoluteAssetURL string) [] StartURL: appURL, Icons: []manifestIcon{ { - Src: absoluteAssetURL + "/img/logo-lg.png", - Type: "image/png", - Sizes: "880x880", - }, - { - Src: absoluteAssetURL + "/img/logo-512.png", + Src: absoluteAssetURL + "/img/logo.png", Type: "image/png", Sizes: "512x512", }, { - Src: absoluteAssetURL + "/img/logo-192.png", - Type: "image/png", - Sizes: "192x192", - }, - { - Src: absoluteAssetURL + "/img/logo-sm.png", - Type: "image/png", - Sizes: "120x120", + Src: absoluteAssetURL + "/img/logo.svg", + Type: "image/svg+xml", + Sizes: "512x512", }, }, }) diff --git a/public/img/gitea-192.png b/public/img/gitea-192.png deleted file mode 100644 index 08baff19e1..0000000000 Binary files a/public/img/gitea-192.png and /dev/null differ diff --git a/public/img/gitea.svg b/public/img/gitea.svg index 38ab3c31ae..dca9b4f4db 100644 --- a/public/img/gitea.svg +++ b/public/img/gitea.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/public/img/logo-192.png b/public/img/logo-192.png deleted file mode 100644 index 08baff19e1..0000000000 Binary files a/public/img/logo-192.png and /dev/null differ diff --git a/public/img/logo-lg.png b/public/img/logo-lg.png deleted file mode 100644 index 5dacd7735d..0000000000 Binary files a/public/img/logo-lg.png and /dev/null differ diff --git a/public/img/logo-safari.svg b/public/img/logo-safari.svg deleted file mode 100644 index cc0e7c73fc..0000000000 --- a/public/img/logo-safari.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/public/img/logo-sm.png b/public/img/logo-sm.png deleted file mode 100644 index f03a64b043..0000000000 Binary files a/public/img/logo-sm.png and /dev/null differ diff --git a/public/img/logo-512.png b/public/img/logo.png similarity index 100% rename from public/img/logo-512.png rename to public/img/logo.png diff --git a/public/img/logo.svg b/public/img/logo.svg index 38ab3c31ae..dca9b4f4db 100644 --- a/public/img/logo.svg +++ b/public/img/logo.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 223fdde8dd..6f19fe5ed6 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -6,7 +6,7 @@ description: | an independent binary distribution across ALL platforms that Go supports, including Linux, Mac OS X, Windows and ARM. -icon: public/img/logo-lg.png +icon: public/img/logo.png confinement: strict base: core18 adopt-info: gitea diff --git a/templates/base/head.tmpl b/templates/base/head.tmpl index 32660df6bb..3c2371f0e9 100644 --- a/templates/base/head.tmpl +++ b/templates/base/head.tmpl @@ -62,10 +62,8 @@ {{end}} }; - + - - {{if .RequireSimpleMDE}} {{end}} @@ -108,7 +106,7 @@ {{else}} - + {{end}} diff --git a/templates/base/head_navbar.tmpl b/templates/base/head_navbar.tmpl index 207c522ee8..a2b4d4f1d9 100644 --- a/templates/base/head_navbar.tmpl +++ b/templates/base/head_navbar.tmpl @@ -1,7 +1,7 @@