1diff --git a/config.example.scfg b/config.example.scfg
2index 5e475486aa8fdbd44dfa826a2dcefb0220954311..e726c190d958729f6754381b46e029baa3cc5d5b 100644
3--- a/config.example.scfg
4+++ b/config.example.scfg
5@@ -3,9 +3,9 @@ # listen-addr tcp://localhost:8080
6 listen-addr unix://var/run/cerrado.sock
7
8 root-readme /srv/git/README.md
9-syntax-highlight monokailight
10+syntax-highlight monokailight monokai
11
12-# full hostname address plus protocol.
13+# full hostname address plus protocol.
14 # This is going to be used to display full link (e.g.: clone link)
15 hostname https://domain.tld
16
17diff --git a/pkg/config/config.go b/pkg/config/config.go
18index c00586bc05d0814c85f32f5124202a999194486c..ff969eca670f7c7872bcffe6700bfbff3e7966ea 100644
19--- a/pkg/config/config.go
20+++ b/pkg/config/config.go
21@@ -39,6 +39,11 @@ Path string
22 Public bool
23 }
24
25+ SyntaxHighlight struct {
26+ Dark string
27+ Light string
28+ }
29+
30 // configuration represents file configuration.
31 // fields needs to be exported to cmp to work
32 configuration struct {
33@@ -50,7 +55,7 @@ RemoveSuffix bool
34 Repositories []*GitRepositoryConfiguration
35 RootReadme string
36 Scans []*scan
37- SyntaxHighlight string
38+ SyntaxHighlight SyntaxHighlight
39 Hostname string
40 }
41
42@@ -75,7 +80,7 @@ passphrase []byte
43 removeSuffix bool
44 repositories []*GitRepositoryConfiguration
45 rootReadme string
46- syntaxHighlight string
47+ syntaxHighlight SyntaxHighlight
48 hostname string
49 }
50 )
51@@ -129,7 +134,11 @@ return c.orderBy
52 }
53
54 func (c *ConfigurationRepository) GetSyntaxHighlight() string {
55- return c.syntaxHighlight
56+ return c.syntaxHighlight.Light
57+}
58+
59+func (c *ConfigurationRepository) GetSyntaxHighlightDark() string {
60+ return c.syntaxHighlight.Dark
61 }
62
63 func (c *ConfigurationRepository) GetListenAddr() string {
64@@ -371,9 +380,26 @@ scanDir := block.Get("aes-key")
65 return setString(scanDir, listenAddr)
66 }
67
68-func setSyntaxHighlight(block scfg.Block, listenAddr *string) error {
69- scanDir := block.Get("syntax-highlight")
70- return setString(scanDir, listenAddr)
71+func setSyntaxHighlight(block scfg.Block, sh *SyntaxHighlight) error {
72+ shDir := block.Get("syntax-highlight")
73+ if shDir == nil {
74+ return nil
75+ }
76+
77+ themes := shDir.Params
78+ if len(themes) > 2 || len(themes) == 0 {
79+ return errors.New("syntax-highlight must contains at most two params and at least one, light then dark theme name")
80+ }
81+
82+ sh.Light = themes[0]
83+ if len(themes) > 1 {
84+ sh.Dark = themes[1]
85+ } else {
86+ // if dark is not set use light
87+ sh.Dark = sh.Light
88+ }
89+
90+ return nil
91 }
92
93 func setOrderby(block scfg.Block, orderBy *string) error {
94diff --git a/pkg/config/config_test.go b/pkg/config/config_test.go
95index 31cf1c07bf73fd1bbd9064cbaa341bea8640e18b..50744b5e879bdbd609b6096c9f6bd7b3ffd1f435 100644
96--- a/pkg/config/config_test.go
97+++ b/pkg/config/config_test.go
98@@ -48,6 +48,21 @@ Repositories: []*GitRepositoryConfiguration{},
99 },
100 },
101 {
102+ name: "themes",
103+ config: `
104+syntax-highlight light dark`,
105+ expectedConfig: &configuration{
106+ Scans: defaultScans(),
107+ ListenAddr: defaultAddr(),
108+ Hostname: defaultHostname(),
109+ Repositories: []*GitRepositoryConfiguration{},
110+ SyntaxHighlight: SyntaxHighlight{
111+ Light: "light",
112+ Dark: "dark",
113+ },
114+ },
115+ },
116+ {
117 name: "minimal repository",
118 config: `repository /srv/git/cerrado.git`,
119 expectedConfig: &configuration{
120@@ -139,13 +154,16 @@ Public: true,
121 Path: "/srv/git",
122 },
123 },
124- ListenAddr: "unix://var/run/cerrado/cerrado.sock",
125- Passphrase: "$2a$14$VnB/ZcB1DUDkMnosRA6Y7.dj8h5eroslDxTeXlLwfQX/x86mh6WAq",
126- AESKey: "8XHptZxSWCGs1m7QzztX5zNQ7D9NiQevVX0DaUTNMbDpRwFzoJiB0U7K6O/kqIt01jJVgzBUfiR8ES46ZLLb4w==",
127- SyntaxHighlight: "monokailight",
128- OrderBy: "lastcommit-desc",
129- RemoveSuffix: true,
130- Hostname: "https://domain.tld",
131+ ListenAddr: "unix://var/run/cerrado/cerrado.sock",
132+ Passphrase: "$2a$14$VnB/ZcB1DUDkMnosRA6Y7.dj8h5eroslDxTeXlLwfQX/x86mh6WAq",
133+ AESKey: "8XHptZxSWCGs1m7QzztX5zNQ7D9NiQevVX0DaUTNMbDpRwFzoJiB0U7K6O/kqIt01jJVgzBUfiR8ES46ZLLb4w==",
134+ SyntaxHighlight: SyntaxHighlight{
135+ Light: "monokailight",
136+ Dark: "monokailight",
137+ },
138+ OrderBy: "lastcommit-desc",
139+ RemoveSuffix: true,
140+ Hostname: "https://domain.tld",
141 Repositories: []*GitRepositoryConfiguration{
142 {
143 Name: "linux.git",