// Colors enable or disable coloring of messages in log.
965997
func (l *Slog) Colors(b bool) *Slog {
	l = l.copy()
	l.colors = b
	l.au = aurora.NewAurora(b)
	return l
}
30794
func (a *HighlightQuadArgs) SetColor(color dom.RGBA) *HighlightQuadArgs {
	a.Color = &color
	return a
}
399139
func (c *Colorize) Color(v string) string {
	matches := parseRe.FindAllStringIndex(v, -1)
	if len(matches) == 0 {
		return v
	}

	result := new(bytes.Buffer)
	colored := false
	m := []int{0, 0}
	for _, nm := range matches {
		// Write the text in between this match and the last
		result.WriteString(v[m[1]:nm[0]])
		m = nm

		var replace string
		if code, ok := c.Colors[v[m[0]+1:m[1]-1]]; ok {
			colored = true

			if !c.Disable {
				replace = fmt.Sprintf("\033[%sm", code)
			}
		} else {
			replace = v[m[0]:m[1]]
		}

		result.WriteString(replace)
	}
	result.WriteString(v[m[1]:])

	if colored && c.Reset && !c.Disable {
		// Write the clear byte at the end
		result.WriteString("\033[0m")
	}

	return result.String()
}
972027
func (p *LogFormatterParams) StatusCodeColor() string {
	code := p.StatusCode

	switch {
	case code >= http.StatusOK && code < http.StatusMultipleChoices:
		return green
	case code >= http.StatusMultipleChoices && code < http.StatusBadRequest:
		return white
	case code >= http.StatusBadRequest && code < http.StatusInternalServerError:
		return yellow
	default:
		return red
	}
}
549599
func (r *Receiver) log(opt *levelOptions, s string) {
	// Don't do anything if not wanted
	if !r.Active || opt.Level < r.Level {
		return
	}

	// Pre- and suffix
	prefix := ""
	suffix := "\n"

	// Add colors if wanted
	if r.Color {
		prefix += fmt.Sprintf("\x1b[0;%sm", strconv.Itoa(opt.Color))
		suffix = "\x1b[0m" + suffix
	}

	// Print to the logger
	r.logger.Printf(prefix+r.Format+suffix, opt.Key, s)
}
350364
func (n *TreeNode) SetColor(color tcell.Color) *TreeNode {
	n.color = color
	return n
}
144797
func (gf *GLFrame) Color(at pixel.Vec) pixel.RGBA {
	if gf.dirty {
		mainthread.Call(func() {
			tex := gf.frame.Texture()
			tex.Begin()
			gf.pixels = tex.Pixels(0, 0, tex.Width(), tex.Height())
			tex.End()
		})
		gf.dirty = false
	}
	if !gf.bounds.Contains(at) {
		return pixel.Alpha(0)
	}
	bx, by, bw, _ := intBounds(gf.bounds)
	x, y := int(at.X)-bx, int(at.Y)-by
	off := y*bw + x
	return pixel.RGBA{
		R: float64(gf.pixels[off*4+0]) / 255,
		G: float64(gf.pixels[off*4+1]) / 255,
		B: float64(gf.pixels[off*4+2]) / 255,
		A: float64(gf.pixels[off*4+3]) / 255,
	}
}
585306
func Color(str string, color int) string {
	return applyTransform(str, func(idx int, line string) string {
		return fmt.Sprintf("%s%s%s", getColor(color), line, RESET)
	})
}
286178
func IsColor(s string) bool {
	r := []rune(s)
	if len(r) != 2 {
		return false
	}
	a := r[1] >= 48 && r[1] <= 57
	b := r[1] >= 97 && r[1] <= 102
	return a || b
}
1008813
func Blue(ctx context.Context, format string, args ...interface{}) {
	if IsHidden(ctx) && !ctxutil.IsDebug(ctx) {
		return
	}
	fmt.Fprint(Stdout, color.BlueString(Prefix(ctx)+format+newline(ctx), args...))
}
516181
func (c Color) RGB() (int32, int32, int32) {
	v := c.Hex()
	if v < 0 {
		return -1, -1, -1
	}
	return (v >> 16) & 0xff, (v >> 8) & 0xff, v & 0xff
}
1171466
func GetColors(bitmap C.MMBitmapRef, x, y int) string {
	clo := GetColor(bitmap, x, y)

	return PadHex(clo)
}
856007
func MustParseHex(s string) colorful.Color {
	c, err := colorful.Hex(s)
	if err != nil {
		panic("MustParseHex: " + err.Error())
	}
	return c
}
568020
func (dc *Context) SetHexColor(x string) {
	r, g, b, a := parseHexColor(x)
	dc.SetRGBA255(r, g, b, a)
}
627010
func (c *Context) ClearColor(r, g, b, a float32) {
	c.Call("clearColor", r, g, b, a)
}
790556
func (h *Client) ScreenColors(screenColors string) *Client {
	h.screenColors = screenColors
	h.screenColorsSet = true
	return h
}
279784
func SetLogLevel(logLevel string) {
	level, err := log.ParseLevel(logLevel)
	errors.CheckError(err)
	log.SetLevel(level)
	if os.Getenv("FORCE_LOG_COLORS") == "1" {
		log.SetFormatter(&log.TextFormatter{ForceColors: true})
	}
}