Skip to content

Commit cc7a4f1

Browse files
GiteaBotsilverwind
andauthored
Don't set meta theme-color by default (#24340) (#24346)
Backport #24340 by @silverwind Fixes #24321. By not setting this meta tag, Safari will use body color for chrome and out-of-viewport areas, which looks much better then static mismatching green. As per [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta/name/theme-color) it's really only Apple browsers who still support this tag, most others have dropped support. Before: <img width="347" alt="Screenshot 2023-04-25 at 19 59 13" src="https://user-images.githubusercontent.com/115237/234363180-0fe667ef-5469-4f5f-b31a-c9d73aff10ac.png"> After: <img width="361" alt="Screenshot 2023-04-25 at 20 00 00" src="https://user-images.githubusercontent.com/115237/234363185-e2d2b62f-0133-4316-944d-b614ffb84eb0.png"> Co-authored-by: silverwind <[email protected]>
1 parent 5f82011 commit cc7a4f1

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

custom/conf/app.example.ini

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1191,10 +1191,9 @@ ROUTER = console
11911191
;; Number of line of codes shown for a code comment
11921192
;CODE_COMMENT_LINES = 4
11931193
;;
1194-
;; Value of `theme-color` meta tag, used by Android >= 5.0
1195-
;; An invalid color like "none" or "disable" will have the default style
1196-
;; More info: https://developers.google.com/web/updates/2014/11/Support-for-theme-color-in-Chrome-39-for-Android
1197-
;THEME_COLOR_META_TAG = `#6cc644`
1194+
;; Value of `theme-color` meta tag, used by some mobile browers for chrome and
1195+
;; out-of-viewport areas. Default is unset which uses body color.
1196+
;THEME_COLOR_META_TAG =
11981197
;;
11991198
;; Max size of files to be displayed (default is 8MiB)
12001199
;MAX_DISPLAY_FILE_SIZE = 8388608

docs/content/doc/administration/config-cheat-sheet.en-us.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ The following configuration set `Content-Type: application/vnd.android.package-a
220220
- `SHOW_USER_EMAIL`: **true**: Whether the email of the user should be shown in the Explore Users page.
221221
- `THEMES`: **auto,gitea,arc-green**: All available themes. Allow users select personalized themes.
222222
regardless of the value of `DEFAULT_THEME`.
223-
- `THEME_COLOR_META_TAG`: **#6cc644**: Value of `theme-color` meta tag, used by Android >= 5.0. An invalid color like "none" or "disable" will have the default style. More info: https://developers.google.com/web/updates/2014/11/Support-for-theme-color-in-Chrome-39-for-Android
223+
- `THEME_COLOR_META_TAG`: **\<empty\>**: Value of `theme-color` meta tag, used by some mobile browers for chrome and out-of-viewport areas. Default is unset which uses body color.
224224
- `MAX_DISPLAY_FILE_SIZE`: **8388608**: Max size of files to be displayed (default is 8MiB)
225225
- `REACTIONS`: All available reactions users can choose on issues/prs and comments
226226
Values can be emoji alias (:smile:) or a unicode emoji.

modules/setting/ui.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ var UI = struct {
7777
GraphMaxCommitNum: 100,
7878
CodeCommentLines: 4,
7979
ReactionMaxUserNum: 10,
80-
ThemeColorMetaTag: `#6cc644`,
80+
ThemeColorMetaTag: ``,
8181
MaxDisplayFileSize: 8388608,
8282
DefaultTheme: `auto`,
8383
Themes: []string{`auto`, `gitea`, `arc-green`},

templates/base/head.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<meta name="viewport" content="width=device-width, initial-scale=1">
66
<title>{{if .Title}}{{.Title | RenderEmojiPlain}} - {{end}}{{if .Repository.Name}}{{.Repository.Name}} - {{end}}{{AppName}}</title>
77
{{if .ManifestData}}<link rel="manifest" href="data:{{.ManifestData}}">{{end}}
8-
<meta name="theme-color" content="{{ThemeColorMetaTag}}">
8+
{{if ThemeColorMetaTag}}<meta name="theme-color" content="{{ThemeColorMetaTag}}">{{end}}
99
<meta name="default-theme" content="{{DefaultTheme}}">
1010
<meta name="author" content="{{if .Repository}}{{.Owner.Name}}{{else}}{{MetaAuthor}}{{end}}">
1111
<meta name="description" content="{{if .Repository}}{{.Repository.Name}}{{if .Repository.Description}} - {{.Repository.Description}}{{end}}{{else}}{{MetaDescription}}{{end}}">

0 commit comments

Comments
 (0)