示例#1
0
文件: color.go 项目: imjerrybao/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:   hex,
		R:     r,
		G:     g,
		B:     b,
		Token: nil,
	}
}
示例#2
0
文件: color.go 项目: imjerrybao/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:   hex,
		R:     r,
		G:     g,
		B:     b,
		Token: nil,
	}
}
示例#3
0
文件: color.go 项目: imjerrybao/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:   hex,
		R:     r,
		G:     g,
		B:     b,
		Token: nil,
	}
}