+ (addition) operator

Type Assocation Precedence Input types Output types
binary left 4 int
float
complex
color
int
float
complex
color

This operator returns the sum of both operands. The type of the result is equal to the largest type of the operands (complex is larger than float, and float is larger than int).

When used with color operands, the + operator returns a color where each component (red, green, blue, alpha) is the sum of the respective components from the operands.

Examples:

3 + 2                      ; 5
3.15 + 9                   ; 12.15
(3, 2) + (6, 4)            ; (9, 6)
rgba(0, 0.1, 0.2, 1) + \
rgba(0.5, 0.49, 0.1, 1)    ; rgba(0.5, 0.59, 0.3, 2)

See Also
Writing direct coloring algorithms
- (subtraction) operator