]> source.dussan.org Git - gitea.git/commitdiff
Set heatmap color range configurable (#5165)
authorAntoine GIRARD <sapk@users.noreply.github.com>
Wed, 24 Oct 2018 14:38:04 +0000 (16:38 +0200)
committerJonas Franz <info@jonasfranz.software>
Wed, 24 Oct 2018 14:38:04 +0000 (16:38 +0200)
custom/conf/app.ini.sample
modules/setting/setting.go
modules/templates/helper.go
templates/base/footer.tmpl

index 47d7bcb6a40500fa08c51b1be5bfd5d81cf95f7d..1a85f9364d645a31bc400390054cef122bf3a1e1 100644 (file)
@@ -85,6 +85,8 @@ MAX_DISPLAY_FILE_SIZE = 8388608
 SHOW_USER_EMAIL = true
 ; Set the default theme for the Gitea install
 DEFAULT_THEME = gitea
+; Set the color range to use for heatmap (default to `['#f4f4f4', '#459928']` but can use `['#2d303b', '#80bb46']` with the theme `arc-green`)
+HEATMAP_COLOR_RANGE = `['#f4f4f4', '#459928']`
 
 [ui.admin]
 ; Number of users that are displayed on one page
index 0523c308981417e3bee5c1bfa5332575a32357a5..0eaf58988fe34c8160ab4304b5f97918061ab99e 100644 (file)
@@ -300,6 +300,7 @@ var (
                MaxDisplayFileSize  int64
                ShowUserEmail       bool
                DefaultTheme        string
+               HeatmapColorRange   string
 
                Admin struct {
                        UserPagingNum   int
@@ -326,6 +327,7 @@ var (
                ThemeColorMetaTag:   `#6cc644`,
                MaxDisplayFileSize:  8388608,
                DefaultTheme:        `gitea`,
+               HeatmapColorRange:   `['#f4f4f4', '#459928']`,
                Admin: struct {
                        UserPagingNum   int
                        RepoPagingNum   int
index ce077d1a928e74f2bf26b3d2dc846f6c51476687..16627549e7c6b8d802b9e4bca82b12ee8d1082c2 100644 (file)
@@ -193,6 +193,9 @@ func NewFuncMap() []template.FuncMap {
                "DefaultTheme": func() string {
                        return setting.UI.DefaultTheme
                },
+               "HeatmapColorRange": func() string {
+                       return setting.UI.HeatmapColorRange
+               },
                "dict": func(values ...interface{}) (map[string]interface{}, error) {
                        if len(values) == 0 {
                                return nil, errors.New("invalid dict call")
index 1734d32600a2b7510451bdb19d35d825f8d5a576..320b4fa1dbf4f7e70e172e76fe3f4755efc84520 100644 (file)
@@ -65,7 +65,7 @@
                        var heatmap = calendarHeatmap()
                                .data(chartData)
                                .selector('#user-heatmap')
-                               .colorRange(['#f4f4f4', '#459928'])
+                               .colorRange({{SafeJS HeatmapColorRange}})
                                .tooltipEnabled(true);
                        heatmap();
                });