Skip to content

Instantly share code, notes, and snippets.

@bcicen
Created June 7, 2019 17:37
Show Gist options
  • Save bcicen/252002e09e55e0439bc400ca785b8bd5 to your computer and use it in GitHub Desktop.
Save bcicen/252002e09e55e0439bc400ca785b8bd5 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"github.com/teacat/noire"
)
func main() {
hue := 320.0
val := 100.0
sats := []float64{100, 70, 30, 10, 5, 0}
for _, sat := range sats {
fmt.Printf("input: h=%.2f s=%.2f v=%.2f\n", hue, sat, val)
c := noire.NewHSV(hue, sat, val)
r, g, b := c.RGB()
rgbTxt := fmt.Sprintf("%d;%d;%d", int(r), int(g), int(b))
fmt.Printf("\033[38;2;%smcolor %s\033[0m", rgbTxt, rgbTxt)
h, s, v := c.HSV()
fmt.Printf(" h=%.2f s=%.2f v=%.2f\n\n", h, s, v)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment