Example #1
0
File: color.go Project: se77en/c6
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, r, g, b, nil}
}
Example #2
0
File: color.go Project: se77en/c6
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, r, g, b, nil}
}
Example #3
0
File: color.go Project: se77en/c6
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, r, g, b, nil}
}