aboutsummaryrefslogtreecommitdiffstats
path: root/bug
diff options
context:
space:
mode:
Diffstat (limited to 'bug')
-rw-r--r--bug/label.go11
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)