// outputNormal provides 8 different colors:
//   black, red, green, yellow, blue, magenta, cyan, white
176837
func (ei *escapeInterpreter) outputNormal() error {
	for _, param := range ei.csiParam {
		p, err := strconv.Atoi(param)
		if err != nil {
			return errCSIParseError
		}

		switch {
		case p >= 30 && p <= 37:
			ei.curFgColor = Attribute(p - 30 + 1)
		case p == 39:
			ei.curFgColor = ColorDefault
		case p >= 40 && p <= 47:
			ei.curBgColor = Attribute(p - 40 + 1)
		case p == 49:
			ei.curBgColor = ColorDefault
		case p == 1:
			ei.curFgColor |= AttrBold
		case p == 4:
			ei.curFgColor |= AttrUnderline
		case p == 7:
			ei.curFgColor |= AttrReverse
		case p == 0:
			ei.curFgColor = ColorDefault
			ei.curBgColor = ColorDefault
		}
	}

	return nil
}
99455
func OutputWriterFromFile(out *os.File) io.Writer {
	return &ColorWriter{w: out, fd: out.Fd(), mutex: &stdOutMutex, lastFgColor: fgWhite}
}
433223
func BgBrightBlack(arg interface{}) Value {
	if val, ok := arg.(Value); ok {
		return val.BgBrightBlack()
	}
	return value{value: arg, color: BrightBg | BlackBg}
}
1117986
func (m ModuleInstance) OutputValue(name string) AbsOutputValue {
	return AbsOutputValue{
		Module: m,
		OutputValue: OutputValue{
			Name: name,
		},
	}
}
796552
func ColorspaceSRGBToLinear() Filter {
	return &colorchanFilter{
		fn: func(x float32) float32 {
			if x <= 0.04045 {
				return x / 12.92
			}
			return float32(math.Pow(float64((x+0.055)/1.055), 2.4))
		},
		lut: true,
	}
}
1165488
func cmpNormBig(z, x *big.Int, xs int, y *big.Int, ys int) (ok bool) {
	if xs != ys {
		z = alias(alias(z, x), y)
		if xs < ys {
			x = arith.MulBigPow10(z, x, uint64(ys-xs))
		} else {
			y = arith.MulBigPow10(z, y, uint64(xs-ys))
		}
	}
	// x and y are non-negative
	return x.Cmp(y) > 0
}
1096383
func RawCombinedOutputNative(args ...string) error {
	if output, err := raw(args...); err != nil || len(output) != 0 {
		return fmt.Errorf("%s (%v)", string(output), err)
	}
	return nil
}
120751
func ColorSubTable(target uint32, start int32, count int32, format uint32, xtype uint32, data unsafe.Pointer) {
	C.glowColorSubTable(gpColorSubTable, (C.GLenum)(target), (C.GLsizei)(start), (C.GLsizei)(count), (C.GLenum)(format), (C.GLenum)(xtype), data)
}
1075342
func NewModeColorWriter(w io.Writer, mode outputMode) io.Writer {
	if _, ok := w.(*colorWriter); !ok {
		return &colorWriter{
			w:    w,
			mode: mode,
		}
	}
	return w
}
1366351
func HSVToRGB(h, s, v float64) color.RGBA {
	var i, f, p, q, t float64

	// Achromatic
	if s == 0 {
		outV := uint8(f64.Clamp(v*255+0.5, 0, 255))
		return color.RGBA{outV, outV, outV, 0xFF}
	}

	h /= 60
	i = math.Floor(h)
	f = h - i
	p = v * (1 - s)
	q = v * (1 - s*f)
	t = v * (1 - s*(1-f))

	var r, g, b float64
	switch i {
	case 0:
		r = v
		g = t
		b = p
	case 1:
		r = q
		g = v
		b = p
	case 2:
		r = p
		g = v
		b = t
	case 3:
		r = p
		g = q
		b = v
	case 4:
		r = t
		g = p
		b = v
	default:
		r = v
		g = p
		b = q
	}

	outR := uint8(f64.Clamp(r*255+0.5, 0, 255))
	outG := uint8(f64.Clamp(g*255+0.5, 0, 255))
	outB := uint8(f64.Clamp(b*255+0.5, 0, 255))
	return color.RGBA{outR, outG, outB, 0xFF}
}
65743
func BrightMagenta(arg interface{}) Value {
	if val, ok := arg.(Value); ok {
		return val.BrightMagenta()
	}
	return value{value: arg, color: BrightFg | MagentaFg}
}
786790
func (ref Ref) OutputVars() VarSet {
	vis := NewVarVisitor().WithParams(VarVisitorParams{SkipRefHead: true})
	Walk(vis, ref)
	return vis.Vars()
}
1017755
func ColorTable(target uint32, internalformat uint32, width int32, format uint32, xtype uint32, table unsafe.Pointer) {
	C.glowColorTable(gpColorTable, (C.GLenum)(target), (C.GLenum)(internalformat), (C.GLsizei)(width), (C.GLenum)(format), (C.GLenum)(xtype), table)
}
1249603
func (p *Pooling) OutputShape(input *TensorDescriptor, dims int) (retVal []int, err error) {
	if dims == p.outDims && shapeEq(input.shape, p.inputTensor) {
		return cloneShape(p.outputShape), nil
	}
	return p.CalcOutputShape(input, dims)
}
32107
func barChart() {
	dumper := NewDumper("xbar1", 3, 2, 400, 300)
	defer dumper.Close()

	red := chart.Style{Symbol: 'o', LineColor: color.NRGBA{0xcc, 0x00, 0x00, 0xff},
		FillColor: color.NRGBA{0xff, 0x80, 0x80, 0xff},
		LineStyle: chart.SolidLine, LineWidth: 2}
	green := chart.Style{Symbol: '#', LineColor: color.NRGBA{0x00, 0xcc, 0x00, 0xff},
		FillColor: color.NRGBA{0x80, 0xff, 0x80, 0xff},
		LineStyle: chart.SolidLine, LineWidth: 2}

	barc := chart.BarChart{Title: "Simple Bar Chart"}
	barc.Key.Hide = true
	barc.XRange.ShowZero = true
	barc.AddDataPair("Amount",
		[]float64{-10, 10, 20, 30, 35, 40, 50},
		[]float64{90, 120, 180, 205, 230, 150, 190}, red)
	dumper.Plot(&barc)
	barc.XRange.TicSetting.Delta = 0

	barc = chart.BarChart{Title: "Simple Bar Chart"}
	barc.Key.Hide = true
	barc.XRange.ShowZero = true
	barc.AddDataPair("Test", []float64{-5, 15, 25, 35, 45, 55}, []float64{110, 80, 95, 80, 120, 140}, green)
	dumper.Plot(&barc)
	barc.XRange.TicSetting.Delta = 0

	barc.YRange.TicSetting.Delta = 0
	barc.Title = "Combined (ugly as bar positions do not match)"
	barc.AddDataPair("Amount", []float64{-10, 10, 20, 30, 35, 40, 50}, []float64{90, 120, 180, 205, 230, 150, 190}, red)
	dumper.Plot(&barc)

	barc.Title = "Stacked (still ugly)"
	barc.Stacked = true
	dumper.Plot(&barc)

	barc = chart.BarChart{Title: "Nicely Stacked"}
	barc.Key.Hide = true
	barc.XRange.Fixed(0, 60, 10)
	barc.AddDataPair("A", []float64{10, 30, 40, 50}, []float64{110, 95, 60, 120}, red)
	barc.AddDataPair("B", []float64{10, 30, 40, 50}, []float64{40, 130, 15, 100}, green)
	dumper.Plot(&barc)

	barc.Stacked = true
	dumper.Plot(&barc)
}
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
}
1081086
func (c HSL) RGBA() (uint32, uint32, uint32, uint32) {
	r, g, b := HSLToRGB(c.H, c.S, c.L)
	return uint32(r) * 0x101, uint32(g) * 0x101, uint32(b) * 0x101, 0xffff
}