Utilities
canvas
counterweight.utils.canvas
canvas(
width: int,
height: int,
cells: dict[tuple[int, int], Color],
default: Color = _BLACK,
) -> list[Chunk]
Render a pixel grid as a list of Chunks using half-block characters (▀).
Each character cell represents two vertically-stacked pixels: the upper pixel maps to the foreground color and the lower pixel maps to the background color. This doubles the effective vertical resolution of a terminal canvas.
width and height are in pixels; height must be even. cells is a sparse mapping
of (x, y) pixel coordinates to colors — unmapped pixels use default (black).
The returned chunks are suitable for use as the content of a Text element.