Skip to content

Commit

Permalink
Document theme configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
aalmiray committed Oct 8, 2020
1 parent 5b77c06 commit 533de83
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
14 changes: 14 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,20 @@ Settings at the project root override those at your home directory. The format i
[source,toml]
.gm.toml
----
[theme]
# valid values are [none, dark, light, custom]
name = "dark"
# if name = custom then you must define the following 5 entries
# color values follow https://github.com/gookit/color#use-a-256-color-style
# color values must be between 0 and 255
# first value is foreground
# second value is background
symbol = [125, 0]
section = [47, 0]
key = [130, 0]
boolean = [200, 0]
literal = [23, 0]
[general]
# same as passing -gq
quiet = false
Expand Down
10 changes: 10 additions & 0 deletions gum/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,26 +329,36 @@ func resolveSectionTheme(t *toml.Tree, config *Config) {
if v != nil {
data := v.([]interface{})
config.theme.symbol = [2]uint8{uint8(data[0].(int64)), uint8(data[1].(int64))}
} else {
config.theme.symbol = [2]uint8{125, 0}
}
v = table.Get("section")
if v != nil {
data := v.([]interface{})
config.theme.section = [2]uint8{uint8(data[0].(int64)), uint8(data[1].(int64))}
} else {
config.theme.symbol = [2]uint8{47, 0}
}
v = table.Get("key")
if v != nil {
data := v.([]interface{})
config.theme.key = [2]uint8{uint8(data[0].(int64)), uint8(data[1].(int64))}
} else {
config.theme.symbol = [2]uint8{130, 0}
}
v = table.Get("boolean")
if v != nil {
data := v.([]interface{})
config.theme.boolean = [2]uint8{uint8(data[0].(int64)), uint8(data[1].(int64))}
} else {
config.theme.symbol = [2]uint8{200, 0}
}
v = table.Get("literal")
if v != nil {
data := v.([]interface{})
config.theme.literal = [2]uint8{uint8(data[0].(int64)), uint8(data[1].(int64))}
} else {
config.theme.symbol = [2]uint8{23, 0}
}
}

Expand Down

0 comments on commit 533de83

Please sign in to comment.