I’m using the P5 Python library and want to create a color with hexadecimal, how can I do this?
To create a color with a hex code, you can do:
For example, if I wanted to create a big red circle, I could use the following sketch:
from p5 import * def setup(): size(640, 640) def draw(): hex_color: str = "#be403b" stroke(hex_color) fill(hex_color) circle((width / 2, height / 2), height/2) run()
which would create a big circle like so:
A big red circle created using the above p5 sketch
Hi I'm Hamilton and I wrote / built this! I like doing lots of things, but mostly I like to build (and then share those buildings). Some things I'm currently building: art, software, and prose. To stay up-to-date with my latest buildings, subscribe to my email list or follow one of my many other accounts. #buildit #shipit #justhamit