func (c RGBColor) RgbString() string {
	return fmt.Sprintf("%d,%d,%d", c[0], c[1], c[2])
}
RgbString to color code string without prefix. eg: "204,123,56"
package color
import (
	"fmt"
	"strconv"
	"strings"
)
const (
	TplFgRGB = "38;2;%d;%d;%d"
	TplBgRGB = "48;2;%d;%d;%d"
	FgRGBPfx = "38;2;"
	BgRGBPfx = "48;2;"
)
const (
	AsFg uint8 = iota
	AsBg
)
type RGBColor [4]uint8
var emptyRGBColor = RGBColor{3: 99}
func RGB(r, g, b uint8, isBg ...bool) RGBColor {
	rgb := RGBColor{r, g, b}
	if len(isBg) > 0 && isBg[0] {
		rgb[3] = AsBg
	}
	return rgb
}
func Rgb(r, g, b uint8, isBg ...bool) RGBColor { return RGB(r, g, b, isBg...) }
func Bit24(r, g, b uint8, isBg ...bool) RGBColor { return RGB(r, g, b, isBg...) }
func RgbFromInt(r, g, b int, isBg ...bool) RGBColor {
	return RGB(uint8(r), uint8(g), uint8(b), isBg...)
}
func RgbFromInts(rgb []int, isBg ...bool) RGBColor {
	return RGB(uint8(rgb[0]), uint8(rgb[1]), uint8(rgb[2]), isBg...)
}
func HEX(hex string, isBg ...bool) RGBColor {
	if rgb := HexToRgb(hex); len(rgb) > 0 {
		return RGB(uint8(rgb[0]), uint8(rgb[1]), uint8(rgb[2]), isBg...)
	}
	return emptyRGBColor
}
func Hex(hex string, isBg ...bool) RGBColor { return HEX(hex, isBg...) }
func HSL(h, s, l float64, isBg ...bool) RGBColor {
	if rgb := HslToRgb(h, s, l); len(rgb) > 0 {
		return RGB(rgb[0], rgb[1], rgb[2], isBg...)
	}
	return emptyRGBColor
}
func Hsl(h, s, l float64, isBg ...bool) RGBColor { return HSL(h, s, l, isBg...) }
func HSLInt(h, s, l int, isBg ...bool) RGBColor {
	if rgb := HslIntToRgb(h, s, l); len(rgb) > 0 {
		return RGB(rgb[0], rgb[1], rgb[2], isBg...)
	}
	return emptyRGBColor
}
func HslInt(h, s, l int, isBg ...bool) RGBColor { return HSLInt(h, s, l, isBg...) }
func RGBFromSlice(rgb []uint8, isBg ...bool) RGBColor {
	return RGB(rgb[0], rgb[1], rgb[2], isBg...)
}
func RGBFromString(rgb string, isBg ...bool) RGBColor {
	if rgbVal, ok := namedRgbMap[rgb]; ok {
		rgb = rgbVal
	}
	ss := stringToArr(rgb, ",")
	if len(ss) != 3 {
		return emptyRGBColor
	}
	var ar [3]int
	for i, val := range ss {
		iv, err := strconv.Atoi(val)
		if err != nil {
			return emptyRGBColor
		}
		ar[i] = iv
	}
	return RGB(uint8(ar[0]), uint8(ar[1]), uint8(ar[2]), isBg...)
}
func (c RGBColor) Set() error {
	return SetTerminal(c.String())
}
func (c RGBColor) Reset() error {
	return ResetTerminal()
}
func (c RGBColor) Print(a ...interface{}) {
	doPrintV2(c.String(), fmt.Sprint(a...))
}
func (c RGBColor) Printf(format string, a ...interface{}) {
	doPrintV2(c.String(), fmt.Sprintf(format, a...))
}
func (c RGBColor) Println(a ...interface{}) {
	doPrintlnV2(c.String(), a)
}
func (c RGBColor) Sprint(a ...interface{}) string {
	return RenderCode(c.String(), a...)
}
func (c RGBColor) Sprintf(format string, a ...interface{}) string {
	return RenderString(c.String(), fmt.Sprintf(format, a...))
}
func (c RGBColor) Values() []int {
	return []int{int(c[0]), int(c[1]), int(c[2])}
}
func (c RGBColor) Code() string {
	return fmt.Sprintf("%d;%d;%d", c[0], c[1], c[2])
}
func (c RGBColor) Hex() string {
	return fmt.Sprintf("%02x%02x%02x", c[0], c[1], c[2])
}