# p5.brush — card for AI agents

MIT JavaScript library that adds pencil, charcoal, marker, watercolor-fill and hatching brushes to p5.js 2.x (or standalone WebGL2) for generative art and prints.

Category: Illustrations · maker acamposuribe (GitHub) · checked 2026-11-25

## Price
- Price: Free
- Free tier: Free and open source (MIT).

## License
MIT — https://github.com/acamposuribe/p5.brush/blob/main/LICENSE.md

- commercial: **yes** (Commercial use OK)
  > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software
  (https://github.com/acamposuribe/p5.brush/blob/main/LICENSE.md)
- attribution: **no** (No credit needed)
  > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
  (https://github.com/acamposuribe/p5.brush/blob/main/LICENSE.md)
- in app: **yes** (Can ship inside your app)
  > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software
  (https://github.com/acamposuribe/p5.brush/blob/main/LICENSE.md)
- redistribute: **yes** (Can pass the files on to your own users)
  > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software
  (https://github.com/acamposuribe/p5.brush/blob/main/LICENSE.md)

## Rules to follow
- Keep the MIT copyright and permission notice in copies of the code.
- Needs p5.js 2.x and a WEBGL canvas (or the standalone build in a WebGL2 browser).
- Install with npm install p5.brush (README).

## Can an AI agent use it by itself?
**Yes** · package: Agent installs a package or loads it from a CDN

## How to connect
- Package (npm/PyPI)
- npm: `npm install p5.brush`
- Repository: https://github.com/acamposuribe/p5.brush
- Website: https://github.com/acamposuribe/p5.brush

## Notes
npm latest is 3.0.0 (2026-10-28); the GitHub README documents the main branch (package.json 3.2.2), which can be ahead of npm.

## Numbers (AgentGid data)
- Gid Score: 36
- GitHub stars: 1,501
- Downloads last week: 28,150

## Lines to paste into your prompt or AGENTS.md

```
- p5.brush (Illustrations). MIT JavaScript library that adds pencil, charcoal, marker, watercolor-fill and hatching brushes to p5.js 2.x (or standalone WebGL2) for generative art and prints. Price: free; commercial use OK; no credit needed.
  Connect: npm p5.brush.
  Rule: Keep the MIT copyright and permission notice in copies of the code.
  Rule: Needs p5.js 2.x and a WEBGL canvas (or the standalone build in a WebGL2 browser).
  Rule: Install with npm install p5.brush (README).
  License: https://github.com/acamposuribe/p5.brush/blob/main/LICENSE.md (checked 2026-11-25; details: https://agentgid.com/assets/p5-brush/)
```

## Links
- AgentGid page: https://agentgid.com/assets/p5-brush/
- Is it free for commercial use? https://agentgid.com/assets/p5-brush/commercial-use/
- Source: https://github.com/acamposuribe/p5.brush
- Source: https://github.com/acamposuribe/p5.brush/blob/main/README.md
- Source: https://github.com/acamposuribe/p5.brush/blob/main/LICENSE.md
- Source: https://registry.npmjs.org/p5.brush/latest


## p5.brush: pencil, ink and watercolor marks in code

p5.brush is a free drawing library that makes pictures drawn in code look hand-made: pencil and charcoal lines, marker and pen strokes, watercolor fills and hatching. It works on top of p5.js, or on its own in any modern browser, and it is made for generative art and large prints. You may use it in paid products under the MIT license.

### Where to use it
- Hand-drawn look for generative art: Give a generative art piece the texture of real pencils, pens and charcoal instead of clean computer lines, for prints or online editions.
- Watercolor fills for shapes: Fill circles, rectangles and free shapes with color that spreads, pools and dries like watercolor, so flat shapes look painted.
- Shading with hatch lines: Shade areas with even rows of hatch lines at the angle and spacing you choose, like an ink drawing.
- Strokes that bend along a flow: Make lines curve and wave on their own by turning on a built-in flow field such as waves, spiral or a gentle hand wobble.
- Your own brushes: Design a new brush with its own texture and pressure in the online Brush Maker, then paste the generated code into the sketch.
- Sketchy illustrations on a landing page: Draw a hero illustration or section dividers in code with a pencil-and-watercolor look, instead of exporting static images. (idea, not from the official pages)

### How to start
- Load p5.js 2.x first, then p5.brush, in this order.

```
<script src="path_to/p5.min.js"></script>
<script src="path_to/p5.brush.js"></script>
```

- Or install it from npm and import the p5 build (or the standalone build, which needs no p5.js).

```
npm install p5.brush --save
import * as brush from 'p5.brush'
```

- Create a WEBGL canvas, pick a brush with brush.set(), then draw with brush.line(), brush.rect() or brush.circle().

### License
MIT license. You may use it in paid apps, client work and art for sale, and ship it inside your app; keep the copyright and license notice with copies of the code. No visible credit is needed.

### Good to know
- The p5 build needs p5.js 2.x and a WEBGL canvas; it does not work with p5.js 1.x.
- There are two builds. The standalone build needs no p5.js, only a browser with WebGL2, and uses its own brush.* calls.
- It comes with 11 brushes, from pencils and pens to pastel, crayon, charcoal, spray and marker.
- The README on GitHub describes the newest code; the released package can be older (3.0.0 on Nov 25, 2026), so a few documented options may be missing there.

Checked 2026-11-25 against: https://github.com/acamposuribe/p5.brush/blob/main/README.md, https://github.com/acamposuribe/p5.brush/blob/main/LICENSE.md, https://github.com/acamposuribe/p5.brush/blob/main/package.json, https://github.com/acamposuribe/p5.brush/blob/main/llms.txt, https://registry.npmjs.org/p5.brush/latest

### Mistakes to avoid
- Don't: Use it with p5.js 1.x or a default 2D canvas → Do: Load p5.js 2.x and create the canvas with createCanvas(w, h, WEBGL) (The p5 build requires p5.js 2.x and a WEBGL canvas)
- Don't: Mix p5 calls such as push(), background() or randomSeed() into a standalone sketch → Do: In the standalone build use brush.push(), brush.clear() and brush.seed(), and call brush.render() at the end of each frame (The two builds have different calls; mixing them breaks the sketch)
- Don't: Import p5.brush as a module and call brush functions in global mode → Do: In instance mode call brush.instance(p) inside the sketch function before setup and draw (With p5 and p5.brush as modules, p5 runs in instance mode)
- Don't: Load p5.brush before p5.js → Do: Put the p5.min.js script tag first, then p5.brush.js (The README gives this order)

### Questions
- Do I need p5.js? For the main build, yes, p5.js 2.x with a WEBGL canvas. The standalone build works without p5.js in a browser with WebGL2.
- Can I sell art or ship an app made with it? Yes. It is under the MIT license; keep the license notice with copies of the code.
- Can I make my own brush? Yes. Add one with brush.add(), or design it in the online Brush Maker and paste the code it gives you.
- Why does my p5.js 1.x sketch not work with it? The library needs p5.js 2.x or higher.

---
AgentGid's catalog is curated: every entry was checked against the maker's official pages (registry, repository, license and pricing pages) on the date shown; a license value shows the quote it stands on wherever AgentGid has one. Usage numbers come from AgentGid's own scan of public repositories set up for AI coding agents. Claims by makers are reported, not tested by AgentGid.
