asciipaint/ docs

API referenceOptions

Options

The second argument to asciipaint() and asciipaintThree(), which takes all but dpr. Three of them change live through set(); the rest are fixed when the paint is created.

options.ts
const paint = asciipaint(canvas, {
  cell: [2.4, 3.4],
  background: "#000000",
});

// live, no rebuild
paint.set({ sparkle: true });

cell

Type
[number, number]
Default
[2.4, 3.4]

CSS px per glyph cell, width then height. Bigger cells read as coarser type and cost less.

cell: [7, 10]

ramp

Type
string
Default
"-=+*#%@"

Glyphs from dark to bright, two or more. Each cell picks one by brightness.

ramp: " .:oO@"

background

Live
Type
string | [r, g, b]
Default
"#F4EEDF"

The paper behind the art. It is always opaque: a fully transparent colour throws a RangeError. Match it to your page and the edges disappear.

background: "#1A2C9A"

edgeFade

Live
Type
number, 0–0.5
Default
0.076

How deep the dithered dissolve reaches into the picture, as a share of its width. 0 gives a hard edge.

edgeFade: 0.2

font

Type
string
Default
600 Geist Mono

Weight and family of a loaded monospace font. Any size is ignored.

sparkle

Live
Type
boolean
Default
false

Bright isolated points become * or + in their own colour, with a glow.

dpr

Type
number
Default
devicePixelRatio

Device pixel ratio. The default is capped at 3 and read again on every resize().