lovr.graphics.setColor

Sets the color used for drawing objects. Color components are from 0.0 to 1.0. Every pixel drawn will be multiplied (i.e. tinted) by this color. This is a global setting, so it will affect all subsequent drawing operations.

lovr.graphics.setColor(r, g, b, a)

Arguments

NameTypeDefaultDescription
rnumberThe red component of the color.
gnumberThe green component of the color.
bnumberThe blue component of the color.
anumber1.0The alpha component of the color.

Returns

Nothing


lovr.graphics.setColor(color)

Arguments

NameTypeDescription
colortableA table containing the color components.

Returns

Nothing

Notes

The default color is white.

Example

Draw a red cube.

function lovr.draw()
  lovr.graphics.setColor(1.0, 0, 0)
  lovr.graphics.cube('fill', 0, 1.7, -1, .5, lovr.timer.getTime())
end

See also