Type Function Object ShapeObject Library display.* Return value none Revision Release 2024.3703 Keywords setStrokeColor, border color, stroke color See also object:setFillColor() display.newRect() display.newRoundRect() display.newCircle() display.newPolygon()
Sets the stroke (border) color of vector objects.
object:setStrokeColor( gray ) object:setStrokeColor( gray, alpha ) object:setStrokeColor( red, green, blue ) object:setStrokeColor( red, green, blue, alpha )
Numbers. Numbers between 0
and 1
that represent the corresponding value for that channel. alpha
represents the opacity of the stroke.
If you are passing a table of color values to this function, the table must be unpacked so that the color values are dictated properly:
local rect = display.newRect( 150, 150, 100, 100 ) local colorTable = { 1, 0, 0, 0.5 } rect:setStrokeColor( unpack(colorTable) )
local rect = display.newRect( 150, 150, 100, 100 ) rect:setFillColor( 1, 1, 0.8 ) rect:setStrokeColor( 1, 0, 0 ) rect.strokeWidth = 8