diff options
author | ludovicm67 <ludovicmuller1@gmail.com> | 2019-08-28 20:32:35 +0200 |
---|---|---|
committer | ludovicm67 <ludovicmuller1@gmail.com> | 2019-10-15 20:42:27 +0200 |
commit | d0d9ea56b9fcb8f2638269b1a6856ef14db7d694 (patch) | |
tree | ef23378e16f1d4a7fbda9b1ad3c95c8b9d95dd2f /bug/label.go | |
parent | 95b9bc94ff30ffe907e87f50bfcc9ea8b5680c61 (diff) | |
download | git-bug-d0d9ea56b9fcb8f2638269b1a6856ef14db7d694.tar.gz |
termui: add colors for labels
Diffstat (limited to 'bug/label.go')
-rw-r--r-- | bug/label.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/bug/label.go b/bug/label.go index 0d6d4142..c224f037 100644 --- a/bug/label.go +++ b/bug/label.go @@ -50,6 +50,17 @@ func (l Label) RGBA() color.RGBA { return colors[id] } +func (l Label) Term256() int { + rgba := l.RGBA() + red := int(rgba.R) * 6 / 256 + green := int(rgba.G) * 6 / 256 + blue := int(rgba.B) * 6 / 256 + + color256 := red*36 + green*6 + blue + 16 + + return color256 +} + func (l Label) Validate() error { str := string(l) |