aboutsummaryrefslogtreecommitdiffstats
path: root/modules/templates/helper.go
diff options
context:
space:
mode:
authorsilverwind <me@silverwind.io>2023-10-06 09:46:36 +0200
committerGitHub <noreply@github.com>2023-10-06 09:46:36 +0200
commit023e937141dd891bce3370c869d4db2c60f971ed (patch)
tree7b31acaf3c87e0d133ab14f6e29338233c717aa7 /modules/templates/helper.go
parent04e88e6ca507448d46981cfb280211d2928fd517 (diff)
downloadgitea-023e937141dd891bce3370c869d4db2c60f971ed.tar.gz
gitea-023e937141dd891bce3370c869d4db2c60f971ed.zip
Rename the default themes to gitea-light, gitea-dark, gitea-auto (#27419)
Part of https://github.com/go-gitea/gitea/issues/27097: - `gitea` theme is renamed to `gitea-light` - `arc-green` theme is renamed to `gitea-dark` - `auto` theme is renamed to `gitea-auto` I put both themes in separate CSS files, removing all colors from the base CSS. Existing users will be migrated to the new theme names. The dark theme recolor will follow in a separate PR. ## :warning: BREAKING :warning: 1. If there are existing custom themes with the names `gitea-light` or `gitea-dark`, rename them before this upgrade and update the `theme` column in the `user` table for each affected user. 2. The theme in `<html>` has moved from `class="theme-name"` to `data-theme="name"`, existing customizations that depend on should be updated. --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Giteabot <teabot@gitea.io>
Diffstat (limited to 'modules/templates/helper.go')
-rw-r--r--modules/templates/helper.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/modules/templates/helper.go b/modules/templates/helper.go
index bb1411cbfd..235fd96b73 100644
--- a/modules/templates/helper.go
+++ b/modules/templates/helper.go
@@ -12,6 +12,7 @@ import (
"strings"
"time"
+ user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/emoji"
"code.gitea.io/gitea/modules/markup"
@@ -131,8 +132,11 @@ func NewFuncMap() template.FuncMap {
"DisableImportLocal": func() bool {
return !setting.ImportLocalPaths
},
- "DefaultTheme": func() string {
- return setting.UI.DefaultTheme
+ "ThemeName": func(user *user_model.User) string {
+ if user == nil || user.Theme == "" {
+ return setting.UI.DefaultTheme
+ }
+ return user.Theme
},
"NotificationSettings": func() map[string]any {
return map[string]any{