Skip to content

Commit

Permalink
Added support for terminal default, and updated the default config to…
Browse files Browse the repository at this point in the history
… reflect that
  • Loading branch information
mcDevnagh committed Jun 19, 2021
1 parent d099812 commit 36963f1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
12 changes: 9 additions & 3 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,9 +349,15 @@ func Init() error {
if !ok {
return fmt.Errorf(`value for "%s" is not a string: %v`, k, v)
}
color := tcell.GetColor(strings.ToLower(colorStr))
if color == tcell.ColorDefault {
return fmt.Errorf(`invalid color format for "%s": %s`, k, colorStr)
colorStr = strings.ToLower(colorStr)
var color tcell.Color
if colorStr == "none" {
color = tcell.ColorDefault
} else {
color = tcell.GetColor(colorStr)
if color == tcell.ColorDefault {
return fmt.Errorf(`invalid color format for "%s": %s`, k, colorStr)
}
}
SetColor(k, color)
}
Expand Down
3 changes: 3 additions & 0 deletions default-config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,8 @@ entries_per_page = 20
# This section is for changing the COLORS used in Amfora.
# These colors only apply if 'color' is enabled above.
# Colors can be set using a W3C color name, or a hex value such as "#ffffff".
# Setting a color to "none" keeps the terminal default
# If your terminal has transparency, set bg to "none" to keep it transparent

# Note that not all colors will work on terminals that do not have truecolor support.
# If you want to stick to the standard 16 or 256 colors, you can get
Expand All @@ -320,6 +322,7 @@ entries_per_page = 20
# EXAMPLES:
# hdg_1 = "green"
# hdg_2 = "#5f0000"
# bg = "none"

# Available keys to set:

Expand Down

0 comments on commit 36963f1

Please sign in to comment.