Set heatmap color range configurable (#5165)
This commit is contained in:
parent
7e5eec430d
commit
ffd5fb8139
|
@ -85,6 +85,8 @@ MAX_DISPLAY_FILE_SIZE = 8388608
|
||||||
SHOW_USER_EMAIL = true
|
SHOW_USER_EMAIL = true
|
||||||
; Set the default theme for the Gitea install
|
; Set the default theme for the Gitea install
|
||||||
DEFAULT_THEME = gitea
|
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]
|
[ui.admin]
|
||||||
; Number of users that are displayed on one page
|
; Number of users that are displayed on one page
|
||||||
|
|
|
@ -300,6 +300,7 @@ var (
|
||||||
MaxDisplayFileSize int64
|
MaxDisplayFileSize int64
|
||||||
ShowUserEmail bool
|
ShowUserEmail bool
|
||||||
DefaultTheme string
|
DefaultTheme string
|
||||||
|
HeatmapColorRange string
|
||||||
|
|
||||||
Admin struct {
|
Admin struct {
|
||||||
UserPagingNum int
|
UserPagingNum int
|
||||||
|
@ -326,6 +327,7 @@ var (
|
||||||
ThemeColorMetaTag: `#6cc644`,
|
ThemeColorMetaTag: `#6cc644`,
|
||||||
MaxDisplayFileSize: 8388608,
|
MaxDisplayFileSize: 8388608,
|
||||||
DefaultTheme: `gitea`,
|
DefaultTheme: `gitea`,
|
||||||
|
HeatmapColorRange: `['#f4f4f4', '#459928']`,
|
||||||
Admin: struct {
|
Admin: struct {
|
||||||
UserPagingNum int
|
UserPagingNum int
|
||||||
RepoPagingNum int
|
RepoPagingNum int
|
||||||
|
|
|
@ -193,6 +193,9 @@ func NewFuncMap() []template.FuncMap {
|
||||||
"DefaultTheme": func() string {
|
"DefaultTheme": func() string {
|
||||||
return setting.UI.DefaultTheme
|
return setting.UI.DefaultTheme
|
||||||
},
|
},
|
||||||
|
"HeatmapColorRange": func() string {
|
||||||
|
return setting.UI.HeatmapColorRange
|
||||||
|
},
|
||||||
"dict": func(values ...interface{}) (map[string]interface{}, error) {
|
"dict": func(values ...interface{}) (map[string]interface{}, error) {
|
||||||
if len(values) == 0 {
|
if len(values) == 0 {
|
||||||
return nil, errors.New("invalid dict call")
|
return nil, errors.New("invalid dict call")
|
||||||
|
|
|
@ -65,7 +65,7 @@
|
||||||
var heatmap = calendarHeatmap()
|
var heatmap = calendarHeatmap()
|
||||||
.data(chartData)
|
.data(chartData)
|
||||||
.selector('#user-heatmap')
|
.selector('#user-heatmap')
|
||||||
.colorRange(['#f4f4f4', '#459928'])
|
.colorRange({{SafeJS HeatmapColorRange}})
|
||||||
.tooltipEnabled(true);
|
.tooltipEnabled(true);
|
||||||
heatmap();
|
heatmap();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue