From 533de83271eb8845eb6b6672616d2b8576b50066 Mon Sep 17 00:00:00 2001 From: Andres Almiray Date: Thu, 8 Oct 2020 23:33:11 +0200 Subject: [PATCH] Document theme configuration --- README.adoc | 14 ++++++++++++++ gum/config.go | 10 ++++++++++ 2 files changed, 24 insertions(+) diff --git a/README.adoc b/README.adoc index 5803922..5c862f9 100644 --- a/README.adoc +++ b/README.adoc @@ -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 diff --git a/gum/config.go b/gum/config.go index 39ab096..33947f6 100644 --- a/gum/config.go +++ b/gum/config.go @@ -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} } }