stroke()

Changes color of lines or shape borders

Example

stroke('purple')
circle(width/2,height/2,200)
line(50,50,350,50)

Syntax

stroke('NAME')

or

stroke(a,b,c)

or

stroke(VALUE)
InputDescription

NAME

the name of any HTML color, for example: blue, green, lightgrey, skyblue, etc...

a,b,c

RGB or HSB values - see Description below

VALUE

a number from 0 - 255, greyscale with 0 being black and 255 being white

Description

Changes the color of the border of all following shapes or lines, until another stroke() is called. Shapes have borders and interiors - stroke() changes the border, while fill() changes the interior. Input can either be the name of an HTML color, a value 0 - 255 for greyscale values with 0 being black and 255 being white. Input can also be three numbers for the RGB or HSB color scale - see colorMode().

Find these documents helpful? Let the people who made them help your child learn to code at Strivemath!

We'd love to hear your Feedback/Comments here.

Last updated