P5 Python Docs
  • Getting Started
  • Simple mode
  • Reference
    • Shapes
      • 2D
        • point()
        • line()
        • rect()
        • square()
        • triangle()
        • circle()
        • ellipse()
        • arc()
        • quad()
        • beginShape()
      • 3D
        • plane()
        • box()
        • sphere()
        • cone()
        • cylinder()
        • ellipsoid()
        • torus()
    • Controlling the environment
      • coordinateMode()
      • rectMode()
      • ellipseMode()
      • frameRate()
      • setup()
      • draw()
    • Built-in Variables
      • Environment
      • Keyboard
      • Mouse
    • Built-in Functions
      • keyIsDown()
      • millis()
      • second()
      • minute()
      • hour()
      • translate()
      • rotate()
      • createSlider()
      • createGraphics()
      • createVector()
    • Events
      • Keyboard
        • keyPressed()
        • keyReleased()
      • Mouse
        • mouseMoved()
        • mouseDragged()
        • mousePressed()
        • doubleClicked()
        • mouseWheel()
    • Text
      • text()
      • textSize()
      • textAlign()
    • Math
      • drawTickAxes()
      • random()
      • randomGaussian()
      • dist()
      • linmap()
      • bounce()
      • wave()
    • Colour and Outline
      • colorMode()
      • fill()
      • stroke()
      • strokeWeight()
      • background()
    • Images & Audio
      • loadImage() and image()
      • loadSound()
    • 3D Controls
      • orbitControl()
      • translate()
      • rotateZ()
      • rotateX()
      • rotateY()
      • scale()
Powered by GitBook
On this page
  • Example
  • Syntax
  • Description
  1. Reference
  2. Colour and Outline

fill()

Changes color of shape interiors

PreviouscolorMode()Nextstroke()

Last updated 2 years ago

Example

fill('purple')
circle(width/2,height/2,200)

Syntax

fill('NAME')

or

fill(a,b,c)

or

fill(VALUE)
Input
Description

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 interior of all following shapes, until another fill() is called. Shapes have borders and interiors - 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 .

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

We'd love to hear your Feedback/Comments .

stroke()
colorMode()
Strivemath
here