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, } }
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, } }
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, } }