// Colorize returns the given string into the specified color.
// Colorize prepends the color sequence to the string and appends the reset color sequence.
333886
func Colorize(s string, color Color) string {
	return color.String() + s + Reset.String()
}
1080729
func Set(p ...Attribute) *Color {
	c := New(p...)
	c.Set()
	return c
}
610484
func Resize(buf []byte, o Options) ([]byte, error) {
	return resizer(buf, o)
}
66795
func Colorize(x string) string {
	attr := 0
	fg := 39
	bg := 49

	for _, key := range x {
		c, ok := codeMap[int(key)]
		switch {
		case !ok:
			log.Printf("Wrong color syntax: %c", key)
		case 0 <= c && c <= 8:
			attr = c
		case 30 <= c && c <= 37:
			fg = c
		case 40 <= c && c <= 47:
			bg = c
		case c == 60:
			fg += c
		}
	}
	return fmt.Sprintf("\033[%d;%d;%dm", attr, fg, bg)
}
1171491
func (c *Color) Set() *Color {
	if c.isNoColorSet() {
		return c
	}

	fmt.Fprintf(Output, c.format())
	return c
}
862366
func ColorizeLevel(level LogLevel) string {
	switch level.Match() {
	case Critical, Error:
		return TermColors{}.Red()
	case Warning:
		return TermColors{}.Magenta()
	case Notice:
		return TermColors{}.Yellow()
	case Info, Debug, Trace:
		return TermColors{}.Green()
	}
	return ""
}
350102
func normaliseColour(colour string) string {
	if ansi, ok := ANSI2RGB[colour]; ok {
		return ansi
	}
	if strings.HasPrefix(colour, "#") {
		colour = colour[1:]
		if len(colour) == 3 {
			return colour[0:1] + colour[0:1] + colour[1:2] + colour[1:2] + colour[2:3] + colour[2:3]
		}
	}
	return colour
}
451308
func Serialize(v interface{}, simple bool) []byte {
	return NewWriter(simple).Serialize(v).Bytes()
}
897375
func (rs *Ruleset) Asciify(word string) string {
	for repl, regex := range lookalikes {
		word = regex.ReplaceAllString(word, repl)
	}
	return word
}
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)
}
232110
func Vectorize(f func(float64) float64) func(xs []float64) []float64 {
	return func(xs []float64) []float64 {
		return Map(f, xs)
	}
}
1249540
func (cb *CellBuffer) Resize(w, h int) {

	if cb.h == h && cb.w == w {
		return
	}

	newc := make([]cell, w*h)
	for y := 0; y < h && y < cb.h; y++ {
		for x := 0; x < w && x < cb.w; x++ {
			oc := &cb.cells[(y*cb.w)+x]
			nc := &newc[(y*w)+x]
			nc.currMain = oc.currMain
			nc.currComb = oc.currComb
			nc.currStyle = oc.currStyle
			nc.width = oc.width
			nc.lastMain = rune(0)
		}
	}
	cb.cells = newc
	cb.h = h
	cb.w = w
}
192309
func (image *Image) Resize(size uint64) error {
	if image.image == nil {
		return RbdErrorImageNotOpen
	}

	return GetError(C.rbd_resize(image.image, C.uint64_t(size)))
}
1110168
func (b *Remote) Colorize() Colorer {
	if b.CLIColor != nil && !b.CLIColor.Disable {
		return b.CLIColor
	}
	if b.CLIColor != nil {
		return &Colorize{cliColor: b.CLIColor}
	}
	return &Colorize{cliColor: &colorstring.Colorize{
		Colors:  colorstring.DefaultColors,
		Disable: true,
	}}
}
770618
func (t Tokenizer) Tokenize(input string) []Token {
	return t.Analyze(input, Normal)
}
88101
func (a *SamplerAggregation) ShardSize(shardSize int) *SamplerAggregation {
	a.shardSize = shardSize
	return a
}
477945
func colorString(code int, str string) string {
	return fmt.Sprintf("\x1b[%d;1m%s\x1b[39;22m", code, str)
}