Skip to content

Commit 533de83

Browse files
committed
Document theme configuration
1 parent 5b77c06 commit 533de83

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

README.adoc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,20 @@ Settings at the project root override those at your home directory. The format i
9797
[source,toml]
9898
.gm.toml
9999
----
100+
[theme]
101+
# valid values are [none, dark, light, custom]
102+
name = "dark"
103+
# if name = custom then you must define the following 5 entries
104+
# color values follow https://github.com/gookit/color#use-a-256-color-style
105+
# color values must be between 0 and 255
106+
# first value is foreground
107+
# second value is background
108+
symbol = [125, 0]
109+
section = [47, 0]
110+
key = [130, 0]
111+
boolean = [200, 0]
112+
literal = [23, 0]
113+
100114
[general]
101115
# same as passing -gq
102116
quiet = false

gum/config.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,26 +329,36 @@ func resolveSectionTheme(t *toml.Tree, config *Config) {
329329
if v != nil {
330330
data := v.([]interface{})
331331
config.theme.symbol = [2]uint8{uint8(data[0].(int64)), uint8(data[1].(int64))}
332+
} else {
333+
config.theme.symbol = [2]uint8{125, 0}
332334
}
333335
v = table.Get("section")
334336
if v != nil {
335337
data := v.([]interface{})
336338
config.theme.section = [2]uint8{uint8(data[0].(int64)), uint8(data[1].(int64))}
339+
} else {
340+
config.theme.symbol = [2]uint8{47, 0}
337341
}
338342
v = table.Get("key")
339343
if v != nil {
340344
data := v.([]interface{})
341345
config.theme.key = [2]uint8{uint8(data[0].(int64)), uint8(data[1].(int64))}
346+
} else {
347+
config.theme.symbol = [2]uint8{130, 0}
342348
}
343349
v = table.Get("boolean")
344350
if v != nil {
345351
data := v.([]interface{})
346352
config.theme.boolean = [2]uint8{uint8(data[0].(int64)), uint8(data[1].(int64))}
353+
} else {
354+
config.theme.symbol = [2]uint8{200, 0}
347355
}
348356
v = table.Get("literal")
349357
if v != nil {
350358
data := v.([]interface{})
351359
config.theme.literal = [2]uint8{uint8(data[0].(int64)), uint8(data[1].(int64))}
360+
} else {
361+
config.theme.symbol = [2]uint8{23, 0}
352362
}
353363
}
354364

0 commit comments

Comments
 (0)