Exemplo n.º 1
0
func HexColorDivNumber(color *ast.HexColor, num *ast.Number) *ast.HexColor {
	r := uint32(math.Floor(float64(color.R) / num.Value))
	g := uint32(math.Floor(float64(color.G) / num.Value))
	b := uint32(math.Floor(float64(color.B) / num.Value))
	hex := ast.Hex(fmt.Sprintf("#%02X%02X%02X", r, g, b))
	return &ast.HexColor{
		Hex:   hex,
		R:     r,
		G:     g,
		B:     b,
		Token: nil,
	}
}
Exemplo n.º 2
0
func HexColorAddNumber(c *ast.HexColor, num *ast.Number) *ast.HexColor {
	r := c.R + uint32(num.Value)
	g := c.G + uint32(num.Value)
	b := c.B + uint32(num.Value)
	hex := ast.Hex(fmt.Sprintf("#%02X%02X%02X", r, g, b))
	return &ast.HexColor{
		Hex:   hex,
		R:     r,
		G:     g,
		B:     b,
		Token: nil,
	}
}
Exemplo n.º 3
0
func HexColorSubNumber(c *ast.HexColor, num *ast.Number) *ast.HexColor {
	val := uint32(num.Value)
	r := uintsub(c.R, val)
	g := uintsub(c.G, val)
	b := uintsub(c.B, val)
	hex := ast.Hex(fmt.Sprintf("#%02X%02X%02X", r, g, b))
	return &ast.HexColor{
		Hex:   hex,
		R:     r,
		G:     g,
		B:     b,
		Token: nil,
	}
}