Skip to main content

Inkplate 6COLOR – Drawing colorful shapes

Colorful Shapes Example

ℹ️
See all available colors and their values here.
Expected output on Inkplate display
Geometric Shapes output on display
# Let's draw some shapes!
# This example will draw shapes around the upper left corner, and then rotate the screen
# This creates a symmetrical-looking pattern of various shapes
for r in range(4):

# Sets the screen rotation
display.setRotation(r)

# Drawing objects
inkplate.drawPixel(100, 100, inkplate.BLACK)
inkplate.drawRect(50, 50, 75, 75, inkplate.GREEN)
inkplate.fillRect(50, 50, 50, 60, inkplate.GREEN)
inkplate.drawCircle(200, 200, 30, inkplate.BLUE)
inkplate.fillCircle(200, 200, 15, inkplate.BLUE)
inkplate.fillCircle(300, 300, 30, inkplate.RED)
inkplate.drawFastHLine(20, 100, 50, inkplate.BLACK)
inkplate.drawFastVLine(100, 20, 50, inkplate.ORANGE)
inkplate.drawLine(100, 100, 400, 400, inkplate.ORANGE)
inkplate.drawRoundRect(100, 10, 100, 100, 10, inkplate.BLACK)
inkplate.fillRoundRect(10, 100, 100, 100, 10, inkplate.ORANGE)
inkplate.fillRoundRect(35, 125, 50, 50, 10, inkplate.BLACK)
inkplate.drawTriangle(300, 100, 400, 150, 400, 100, inkplate.BLACK)
inkplate.fillTriangle(350, 100, 400, 175, 400, 100, inkplate.YELLOW)

# Reset the rotation
display.setRotation(0)

# Show on the display
display.display()

inkplate.setRotation()

Sets the rotation of the screen, adjusting the (x, y) coordinate origin point

Returns value: None

Function parameters:

TypeNameDescription
intxValue from 0 to 3 (1 rotates by 90 degrees, 2 by 180 degrees, 3 by 270 degrees, 0 is default rotation)

inkplate.drawPixel()

Sets pixel data on given (x, y) position

Returns value: None

Function parameters:

TypeNameDescription
intxX coordinate
intyY coordinate
intcPixel color

inkplate.drawRect()

Function to draw a rectangle

Returns value: None

Function parameters:

TypeNameDescription
intxX coordinate
intyY coordinate
intwidthRectangle width
intheightRectangle height
intcRectangle color

inkplate.drawCircle()

Function to draw a circle

Returns value: None

Function parameters:

TypeNameDescription
intxX coordinate
intyY coordinate
intrCircle radius
intcCircle color

inkplate.fillCircle()

Function to draw a filled circle with specified color

Returns value: None

Function parameters:

TypeNameDescription
intxX coordinate
intyY coordinate
intrCircle radius
intcCircle fill color

inkplate.drawFastHLine()

Function to draw a horizontal line

Returns value: None

Function parameters:

TypeNameDescription
intxX start coordinate
intyY start coordinate
intwidthLine width to set how many pixels to draw
intcLine color

inkplate.drawFastVLine()

Function to draw a vertical line

Returns value: None

Function parameters:

TypeNameDescription
intxX coordinate
intyY coordinate
intwidthLine width to set how many pixels to draw
intcLine color

inkplate.drawLine()

Function to draw a line from start to end

Returns value: None

Function parameters:

TypeNameDescription
intx0X coordinate for first point
inty0Y coordinate for first point
intx1X coordinate for second point
inty1Y coordinate for second point
intwidthLine width
intcLine color

inkplate.drawRoundRect()

Function to draw a rectangle with rounded edges

Returns value: None

Function parameters:

TypeNameDescription
intxX coordinate
intyY coordinate
intwidthRectangle width
intheightRectangle height
intradiusBorder radius
intcRectangle color

inkplate.fillRoundRect()

Function to draw a rounded rectangled filled with specified color

Returns value: None

Function parameters:

TypeNameDescription
intxX coordinate
intyY coordinate
intwidthRectangle width
intheightRectangle height
intradiusBorder radius
intcRectangle color

inkplate.drawTriangle()

Function to draw a triangle

Returns value: None

Function parameters:

TypeNameDescription
intx0X coordinate for first point
inty0Y coordinate for first point
intx1X coordinate for second point
inty1Y coordinate for second point
intx2X coordinate for third point
inty2Y coordinate for third point
intcTriangle color

inkplate.fillTriangle()

Function to draw a triangle filled with specified color

Returns value: None

Function parameters:

TypeNameDescription
intx0X coordinate for first point
inty0Y coordinate for first point
intx1X coordinate for second point
inty1Y coordinate for second point
intx2X coordinate for third point
inty2Y coordinate for third point
intcTriangle fill color