# solandra

> A framework for algorithmic art. TypeScript first. Make drawing concepts part of framework. Make APIs for humans.

Latest version **0.24.0** (published 2026-09-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install solandra
pnpm add solandra
yarn add solandra
bun add solandra
```

## Health

**Score 65/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.24.0 |
| Published | 2026-09-05 |
| First published | 2019-07-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 474.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 180 |
| Author | James Porter |
| Maintainers | jamesporter |
| Keywords | generative-art, algorithmic-art, creative-coding, canvas, graphics, typescript |

## Links

- npm: https://www.npmjs.com/package/solandra
- Repository: https://github.com/jamesporter/solandra
- Homepage: https://solandra.amimetic.co.uk
- Issues: https://github.com/jamesporter/solandra/issues
- npm.io page: https://npm.io/package/solandra

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 0.24.0 (latest) — 2026-09-05
- 0.23.0 — 2026-09-05
- 0.22.0 — 2026-08-07
- 0.21.0 — 2026-07-05
- 0.20.0 — 2026-01-29
- 0.19.0 — 2024-05-30
- 0.18.0 — 2024-04-09
- 0.17.0 — 2022-07-14
- 0.16.0 — 2022-06-02
- 0.15.1 — 2020-09-27
- 0.15.0 — 2020-09-08
- 0.14.0 — 2019-12-29
- 0.13.0 — 2019-11-18
- 0.12.0 — 2019-10-14
- 0.11.0 — 2019-09-29
- … 11 more at https://npm.io/package/solandra/versions

## README

# Solandra

## Principles

Opinionated, agile (code is easy to change) framework for algorithmic art. See my [essays](https://www.amimetic.co.uk/art/) for research/plans that went into this!

- Sketches always have width 1, height depends on aspect ratio.
- Angles in radians.
- Points are [number, number].
- Colours in hsl(a).
- Leverage TypeScript: you shouldn't need to learn much, autocomplete and type checking should have your back.
- Not for beginners.
- Control flow at level of drawing (tiling, partitions etc).
- Few dependencies/mostly from scratch.
- Performance is not the goal.
- Common algorithmic art things (e.g. randomness) should be easy.
- Should feel fun/powerful.
- Life is too short to compile things.
- Rethink APIs e.g. standard bezier curve APIs make absolutely no sense
- Declarative when possible (especially anything configuration-y), procedural when pragmatic; make it easy to explore/change your mind.

![Examples](/public/images/samples.png)

## Get Started

- On CodeSandbox, quickly get started: [Simple editable sketch](https://codesandbox.io/s/simple-solandra-example-2-wy7nx?fontsize=14)
- Clone [this project](https://github.com/jamesporter/solandra) to try out as add React powered GUI around stuff but first see it [live](https://solandra.amimetic.co.uk/).
- On [NPM](https://www.npmjs.com/package/solandra). Install with `pnpm add solandra`, `npm i solandra` or `yarn add solandra`.

Or if you want to play locally clone this repo, install dependencies with `pnpm i` and start by:

```
pnpm dev
```

Then open [http://localhost:3000](http://localhost:3000) and in your editor `sketches.ts` and try things out.

`pnpm test` runs the unit tests, and `pnpm check:samples` re-renders every
example and checks it still looks like the image committed in `samples/` — see
[scripts/README.md](./scripts/README.md) if that one fails on you.

It does things like the below

![A simple example drawn with tiles](/public/images/tiles.png)

```typescript
p.forTiling({ n: 20, margin: 0.1, type: "square" }, ([x, y], [dX, dY]) => {
  p.lineStyle = { cap: "round" }
  p.setStrokeColor(120 + x * 120, 90 - 20 * y, 40)
  p.proportionately([
    [1, () => p.draw(new Line([x, y], [x + dX, y + dY]))],
    [2, () => p.draw(new Line([x + dX, y], [x, y + dY]))],
  ])
})
```

![An example](public/images/1.png)

![An example](public/images/2.png)

![An example](public/images/3.png)

![An example](public/images/4.png)

[Over 140 Examples](./samples/samples.md)

![New in 0.18: Palettes](public/images/5.png)

## Use with AI

There is a lot more graphics code out there which uses verbose, tedious APIs. To leverage LLMs with Solandra you will want to tell them about how Solandra works. You can copy and paste [llm.md](./llm.md) into your projects and markdown slash/custom command files. For example with e.g. Claude Code the following approach should work well for a 'daily sketches' project, providing a new slash command `new-sketch`.

Create a new file like `.claude/commands/new-sketch.md`

````md
---
description: Create a new sketch
---

- Identify the largest numbered sketch like src/sketches/sketch-N.tsx
- Create a new file src/sketches/sketch-N+1.tsx by incrementing N (but do pad with up to 2 zeros)

Should look like this initially, but replace the {NUMBER_PADDED} and {DO_SKETCH_HERE} parts:

```tsx
import { Circle, type SCanvas } from "solandra"
import { Canvas } from "../components/Canvas"

const sketch = (s: SCanvas) => {
  s.background(20, 20, 30)

  {DO_SKETCH_HERE}
}

const Sketch{NUMBER_PADDED} = () => <Canvas sketch={sketch} />

export default Sketch{NUMBER_PADDED}
```

- do some kind of generative art sketch in the sketch function using the Solandra library
- Add to src/App.tsx
- Add to src/Directory.tsx
- Do not run any checks or formatting, do not run the server; just generated and update files

# Guide on how to use Solandra
````

then add the full contents of [llm.md](./llm.md) to the end.

---
_Source: https://npm.io/package/solandra · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
