diff options
author | mjarkk <mkopenga@gmail.com> | 2019-10-19 11:39:18 +0200 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2019-10-20 12:32:57 +1100 |
commit | a045313e080d2c083425e89cfd8a004cbcf72ef7 (patch) | |
tree | 72e916f19a2b71e04dfa146823e5f0575cd8e855 /pkg/theme | |
parent | 9bd2dc3050b5342ee708a7d189986eaf16b1c9ff (diff) |
Removed the pkg/gui/theme.go file
Moved most functions to the new theme/theme.go
Diffstat (limited to 'pkg/theme')
-rw-r--r-- | pkg/theme/theme.go | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/pkg/theme/theme.go b/pkg/theme/theme.go index 4b2c0e9b2..a991db91a 100644 --- a/pkg/theme/theme.go +++ b/pkg/theme/theme.go @@ -66,3 +66,35 @@ func getColor(keys []string) gocui.Attribute { } return attribute } + +// GetAttribute gets the gocui color attribute from the string +func GetAttribute(key string) gocui.Attribute { + colorMap := map[string]gocui.Attribute{ + "default": gocui.ColorDefault, + "black": gocui.ColorBlack, + "red": gocui.ColorRed, + "green": gocui.ColorGreen, + "yellow": gocui.ColorYellow, + "blue": gocui.ColorBlue, + "magenta": gocui.ColorMagenta, + "cyan": gocui.ColorCyan, + "white": gocui.ColorWhite, + "bold": gocui.AttrBold, + "reverse": gocui.AttrReverse, + "underline": gocui.AttrUnderline, + } + value, present := colorMap[key] + if present { + return value + } + return gocui.ColorWhite +} + +// GetColor bitwise OR's a list of attributes obtained via the given keys +func GetColor(keys []string) gocui.Attribute { + var attribute gocui.Attribute + for _, key := range keys { + attribute |= GetAttribute(key) + } + return attribute +} |