// Rgb returns the tree components of the color as bytes (r, g and b)
974030
func (color TrueColor) Rgb() (byte, byte, byte) {
	return byte((color >> 16) & 0xFF), byte((color >> 8) & 0xFF), byte(color & 0xFF)
}
145219
func BgRed(arg interface{}) Value {
	if val, ok := arg.(Value); ok {
		return val.BgRed()
	}
	return value{value: arg, color: RedBg}
}
295173
func HexToRgb(hex uint32) *C.uint8_t {
	return C.color_hex_to_rgb(C.uint32_t(hex))
}
1225259
func (dc *Context) SetRGBA(r, g, b, a float64) {
	dc.color = color.NRGBA{
		uint8(r * 255),
		uint8(g * 255),
		uint8(b * 255),
		uint8(a * 255),
	}
	dc.setFillAndStrokeColor(dc.color)
}
1340822
func (c Color) Hex() int32 {
	if c&ColorIsRGB != 0 {
		return (int32(c) & 0xffffff)
	}
	if v, ok := ColorValues[c]; ok {
		return v
	}
	return -1
}
1107841
func RGBToHSV(c color.Color) (h, s, v float64) {
	r, g, b, _ := c.RGBA()
	fR := float64(r) / 255
	fG := float64(g) / 255
	fB := float64(b) / 255
	max := math.Max(math.Max(fR, fG), fB)
	min := math.Min(math.Min(fR, fG), fB)
	d := max - min
	s, v = 0, max
	if max > 0 {
		s = d / max
	}
	if max == min {
		// Achromatic.
		h = 0
	} else {
		// Chromatic.
		switch max {
		case fR:
			h = (fG - fB) / d
			if fG < fB {
				h += 6
			}
		case fG:
			h = (fB-fR)/d + 2
		case fB:
			h = (fR-fG)/d + 4
		}
		h /= 6
	}
	return
}
313291
func PieColor(renderer *sdl.Renderer, x, y, rad, start, end int32, color sdl.Color) bool {
	_x := C.Sint16(x)
	_y := C.Sint16(y)
	_rad := C.Sint16(rad)
	_start := C.Sint16(start)
	_end := C.Sint16(end)
	_color := C.Uint32(gfxColor(color))
	return C.pieColor((*C.SDL_Renderer)(unsafe.Pointer(renderer)), _x, _y, _rad, _start, _end, _color) == 0
}
880468
func Color(value string) *trees.Style {
	return &trees.Style{Name: "color", Value: value}
}
16863
func LinearRgb(r, g, b float64) Color {
	return Color{delinearize(r), delinearize(g), delinearize(b)}
}
1232255
func BgBrightGreen(arg interface{}) Value {
	if val, ok := arg.(Value); ok {
		return val.BgBrightGreen()
	}
	return value{value: arg, color: BrightBg | GreenBg}
}
953599
func (formatter *Formatter) Color(text string) string {
	var levelColor []byte
	if formatter.Event.Level >= event.Error {
		levelColor = colors.Red
	} else if formatter.Event.Level == event.Warning {
		levelColor = colors.Yellow
	} else {
		levelColor = colors.Cyan
	}
	return fmt.Sprintf("%s%s%s", levelColor, text, colors.Reset)
}
804392
func (c *Canvas) Color(at pixel.Vec) pixel.RGBA {
	return c.gf.Color(at)
}
900750
func NewRGB8Bit(r, g, b uint8) RGB8Bit {
	return RGB8Bit(16 + 36*(r/43) + 6*(g/43) + b/43)
}
1157390
func (c Color) String() string {
	fa := float64(c.A) / float64(255)
	return fmt.Sprintf("rgba(%v,%v,%v,%.1f)", c.R, c.G, c.B, fa)
}
6587
func (w *Waveform) SetBGColorFunction(function ColorFunc) error {
	return w.SetOptions(BGColorFunction(function))
}
965997
func (l *Slog) Colors(b bool) *Slog {
	l = l.copy()
	l.colors = b
	l.au = aurora.NewAurora(b)
	return l
}
627010
func (c *Context) ClearColor(r, g, b, a float32) {
	c.Call("clearColor", r, g, b, a)
}