summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Nering <andrey.nering@gmail.com>2016-02-08 17:03:18 -0200
committerAndrey Nering <andrey.nering@gmail.com>2016-02-08 17:03:18 -0200
commite40d94bb4f46a60b15a1d461f1fbbf76130a07e0 (patch)
tree7b8052d8f28ba4ac76db26f094ce58a9776e4bea
parent7ffe845c61fde3b2eac821a303668206b014a666 (diff)
downloadgitea-e40d94bb4f46a60b15a1d461f1fbbf76130a07e0.tar.gz
gitea-e40d94bb4f46a60b15a1d461f1fbbf76130a07e0.zip
Implementing the "theme-color" meta tag.
Used by Android >= 5.0 to make the top bar colored. Reference: https://developers.google.com/web/updates/2014/11/Support-for-theme-color-in-Chrome-39-for-Android
-rw-r--r--conf/app.ini4
-rw-r--r--modules/setting/setting.go2
-rw-r--r--modules/template/template.go3
-rw-r--r--templates/base/head.tmpl2
4 files changed, 11 insertions, 0 deletions
diff --git a/conf/app.ini b/conf/app.ini
index d62a9e1ee0..8b19e725e6 100644
--- a/conf/app.ini
+++ b/conf/app.ini
@@ -27,6 +27,10 @@ EXPLORE_PAGING_NUM = 20
ISSUE_PAGING_NUM = 10
; Number of maximum commits showed in one activity feed
FEED_MAX_COMMIT_NUM = 5
+; 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
+THEME_COLOR_META_TAG = `#ff5343`
[ui.admin]
; Number of users that are showed in one page
diff --git a/modules/setting/setting.go b/modules/setting/setting.go
index 99b968c880..00dae6f621 100644
--- a/modules/setting/setting.go
+++ b/modules/setting/setting.go
@@ -114,6 +114,7 @@ var (
AdminRepoPagingNum int
AdminNoticePagingNum int
AdminOrgPagingNum int
+ ThemeColorMetaTag string
// Markdown sttings
Markdown struct {
@@ -407,6 +408,7 @@ func NewContext() {
AdminRepoPagingNum = sec.Key("REPO_PAGING_NUM").MustInt(50)
AdminNoticePagingNum = sec.Key("NOTICE_PAGING_NUM").MustInt(50)
AdminOrgPagingNum = sec.Key("ORG_PAGING_NUM").MustInt(50)
+ ThemeColorMetaTag = sec.Key("THEME_COLOR_META_TAG").MustString("#ff5343")
sec = Cfg.Section("picture")
PictureService = sec.Key("SERVICE").In("server", []string{"server"})
diff --git a/modules/template/template.go b/modules/template/template.go
index 6099fcc987..aefb21946d 100644
--- a/modules/template/template.go
+++ b/modules/template/template.go
@@ -98,6 +98,9 @@ var Funcs template.FuncMap = map[string]interface{}{
return strings.Replace(strings.Replace(str, "%", "%25", -1), "#", "%23", -1)
},
"RenderCommitMessage": RenderCommitMessage,
+ "ThemeColorMetaTag": func() string {
+ return setting.ThemeColorMetaTag
+ },
}
func Safe(raw string) template.HTML {
diff --git a/templates/base/head.tmpl b/templates/base/head.tmpl
index ce78613534..0ef9ea93d9 100644
--- a/templates/base/head.tmpl
+++ b/templates/base/head.tmpl
@@ -34,6 +34,8 @@
<script src="{{AppSubUrl}}/js/gogs.js?v={{MD5 AppVer}}"></script>
<title>{{if .Title}}{{.Title}} - {{end}}{{AppName}}</title>
+
+ <meta name="theme-color" content="{{ThemeColorMetaTag}}">
</head>
<body>
<div class="full height">