Use terminal color library

This commit is contained in:
2021-03-07 10:28:21 -06:00
parent 518e304948
commit 40851c6a62
5 changed files with 36 additions and 21 deletions

24
cmd/print.go Normal file
View File

@ -0,0 +1,24 @@
package lumecmd
import (
"git.kill0.net/chill9/lifx-go"
"github.com/fatih/color"
)
func ColorizePower(s string) string {
c := color.New(color.FgRed)
if s == "on" {
c = color.New(color.FgGreen)
}
return c.Sprint(s)
}
func ColorizeStatus(s lifx.Status) string {
c := color.New(color.FgRed)
if s == "ok" {
c = color.New(color.FgGreen)
}
return c.Sprint(s)
}