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
# Include all the required libraries
from inkplate6_color import Inkplate

# Create Inkplate object
inkplate = Inkplate()


# Initialize the display, needs to be called only once
inkplate.begin()

# 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
inkplate.set_rotation(r)

# All drawing functions
# Available colors are:
# Black, white, green, blue, red, yellow, orange
inkplate.draw_pixel(100, 100, inkplate.BLACK)
inkplate.draw_rect(50, 50, 75, 75, inkplate.GREEN)
inkplate.draw_circle(200, 200, 30, inkplate.BLUE)
inkplate.fill_circle(300, 300, 30, inkplate.RED)
inkplate.draw_fast_hline(20, 100, 50, inkplate.BLACK)
inkplate.draw_fast_vline(100, 20, 50, inkplate.ORANGE)
inkplate.draw_line(100, 100, 400, 400, inkplate.ORANGE)
inkplate.draw_round_rect(100, 10, 100, 100, 10, inkplate.BLACK)
inkplate.fill_round_rect(10, 100, 100, 100, 10, inkplate.YELLOW)
inkplate.draw_triangle(300, 100, 400, 150, 400, 100, inkplate.BLACK)

# Reset the rotation
inkplate.set_rotation(0)

# Show on the display
inkplate.display()

inkplate.set_rotation()

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

Returns type: 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.draw_pixel()

Sets pixel data on given (x, y) position

Returns type: none

Function parameters:

TypeNameDescription
intxX coordinate
intyY coordinate
intcPixel color

inkplate.draw_rect()

Function to draw a rectangle

Returns type: none

Function parameters:

TypeNameDescription
intxX coordinate
intyY coordinate
intwidthRectangle width
intheightRectangle height
intcRectangle color

inkplate.draw_circle()

Function to draw a circle

Returns type: none

Function parameters:

TypeNameDescription
intxX coordinate
intyY coordinate
intrCircle radius
intcCircle color

inkplate.fill_circle()

Function to draw a filled circle with specified color

Returns type: none

Function parameters:

TypeNameDescription
intxX coordinate
intyY coordinate
intrCircle radius
intcCircle fill color

inkplate.draw_fast_hline()

Function to draw a horizontal line

Returns type: none

Function parameters:

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

inkplate.draw_fast_vline()

Function to draw a vertical line

Returns type: none

Function parameters:

TypeNameDescription
intxX start coordinate
intyY start coordinate
intheightLine height to set how many pixels to draw
intcLine color

inkplate.draw_line()

Function to draw a line from start to end

Returns type: none

Function parameters:

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

inkplate.draw_round_rect()

Function to draw a rectangle with rounded edges

Returns type: none

Function parameters:

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

inkplate.fill_round_rect()

Function to draw a rounded rectangled filled with specified color

Returns type: none

Function parameters:

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

inkplate.draw_triangle()

Function to draw a triangle

Returns type: 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.fill_triangle()

Function to draw a triangle filled with specified color

Returns type: 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

Full examples

basic_color.py

Example showing how to draw shapes around the upper left corner and then rotate the screen.

draw_color_image.py

Draw a small pre-packed color image buffer directly onto the screen.