Skip to content

art

pictures made of text: clip art, colored text, QR codes, images, and animation

Permissions: files.read

Art covers anything drawn with characters. It has ready-made clip art, colored text, QR codes and images turned into text, plus animation. The submodules arrange pictures, grow them from rules, draw games, and render big letters and photos.

  • clipart a piece of clip art from the built-in gallery by name, or with no name, the list of names
  • rainbow color text with a rainbow running diagonally across it
  • gradient color text with a fade from one color on the left to another on the right
  • qr a QR code for the text that phones can scan off the screen
  • segments big digits like a digital clock’s, for 0-9, A-F, -, ., : and spaces
  • img draw an image, from its path or its bytes, width characters wide (the terminal’s width without one, or 80)
  • lsb the low bits of an image’s pixels as bytes, the usual way to hide a message in a picture
  • bit_plane one bit of one color channel of an image as a black and white PNG, white where the bit is set
  • animate play an animation in the terminal at fps frames a second
clipart(name?: str) -> str|list

a piece of clip art from the built-in gallery by name, or with no name, the list of names

1
clipart("owl")
,_, (O,O) ( ) -"-"-
2
clipart().len19
Example outputCtrl+Enter to run

See also say, boxed

rainbow(s: str) -> str

color text with a rainbow running diagonally across it

1
"rainbow".rainbowrainbow
Example outputCtrl+Enter to run

See also gradient, strip_ansi

gradient(s: str, from: str|list, to: str|list) -> str

color text with a fade from one color on the left to another on the right

1
gradient("sunset", "gold", "crimson")sunset
Example outputCtrl+Enter to run

See also rainbow, color

qr(text: str, ec: str = “M”) -> str

a QR code for the text that phones can scan off the screen

ec is how much damage it can survive and still scan: “L” 7%, “M” 15%, “Q” 25% or “H” 30%. Higher makes a bigger code

1
qr("zil")
█████████████████████████████ █████████████████████████████ ████ ▄▄▄▄▄ █▄▀▄███ ▄▄▄▄▄ ████ ████ █ █ █▀▄██ █ █ █ ████ ████ █▄▄▄█ █ █ ▀▄█ █▄▄▄█ ████ ████▄▄▄▄▄▄▄█ █▄▀ █▄▄▄▄▄▄▄████ ████ ▀██ █▄▄▄█▀ ▀▄▄ ▄▄█▀▄████ ████▀▄▄▀▀▀▄ █▄▀▄█▀ ▄ ██▄▀████ ████████▄█▄█ ██ ██▀█▄█████ ████ ▄▄▄▄▄ █▄█ ▀ ▄█▀█ █ ▀████ ████ █ █ █▄ ▀ ▀█▄ ▄▀▄ ████ ████ █▄▄▄█ ██▄▀▄█▀ ▄ ▄ ██████ ████▄▄▄▄▄▄▄█▄▄▄█▄▄▄███▄█▄████ █████████████████████████████ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
Example outputCtrl+Enter to run

See also url_build

segments(s: str|int) -> str

big digits like a digital clock’s, for 0-9, A-F, -, ., : and spaces

1
segments("12:45")
▄▄ ▄▄ █ ▄▄█ • █▄▄█ █▄▄ █ █▄▄ • █ ▄▄█
2
segments("C0FFEE")
▄▄ ▄▄ ▄▄ ▄▄ ▄▄ ▄▄ █ █ █ █▄▄ █▄▄ █▄▄ █▄▄ █▄▄ █▄▄█ █ █ █▄▄ █▄▄
Example outputCtrl+Enter to run

See also banner, clock

img(file: str|bytes, width?: int, mode: str = “blocks”) -> str

draw an image, from its path or its bytes, width characters wide (the terminal’s width without one, or 80)

mode is “blocks”, two pixels per character in full color, “ascii”, brightness drawn with the characters .:-=+*#%@ so it pastes anywhere, or “braille”, black-and-white dots, 8 per character, the sharpest of the three

1
img("cat.png")
2
img("logo.jpg", 40, "ascii")
3
img("photo.png", 60, "braille").negative
Example outputCtrl+Enter to run

See also negative, boxed, bit_plane

lsb(file: str|bytes, bits: int = 1, channels: str = “rgb”) -> bytes

the low bits of an image’s pixels as bytes, the usual way to hide a message in a picture

Takes a path or bytes. Reads bits (1 by default) from each of channels, any of “r”, “g”, “b” and “a” in order, pixel by pixel along each row from the top, and packs them most significant first. Try .str or magic on the result

1
lsb("secret.png")[..32].str
2
lsb("secret.png", 2, "b")
Example outputCtrl+Enter to run

See also bit_plane, png_chunks

bit_plane(file: str|bytes, channel: str, bit: int) -> bytes

one bit of one color channel of an image as a black and white PNG, white where the bit is set

Takes a path or bytes. channel is “r”, “g”, “b” or “a”, and bit goes from 0, the lowest, to 7. Hidden pictures and text often show up in bit 0, so draw the result with img

1
img(bit_plane("secret.png", "r", 0))
Example outputCtrl+Enter to run

See also lsb, img

animate(frames: list|fn, fps: num = 10.0, count?: int) -> nil

play an animation in the terminal at fps frames a second

A list of pictures plays count times (once without one), and a function is called with each frame number from 0 and plays count frames (60 without one). When the output isn’t a terminal, only the last frame is printed

1
animate(|i| life("glider", i), 8, 40)
2
animate(["|", "/", "-", "\\"], 12, 5)
Example outputCtrl+Enter to run

See also life, fractal

1
# the names of every piece in the gallery
2
clipart()["cat", "dog", "owl", "bunny", "cow", "pikachu", "fish", "duck", "bat", "snail", "crab", "ghost", "skull", "coffee", "rocket", "house", "tree", "cactus", "heart"]
3
# a cat in a box
4
clipart("cat").boxed("round")
╭─────────╮ │ /\_/\ │ │ ( o.o ) │ │ > ^ < │ ╰─────────╯
5
# a rainbow banner
6
banner("zil", "slant").rainbow
_ __ ____ (_) / /_ / / / / / /_/ / / /___/_/_/
7
# color codes don't count once stripped
8
rainbow("hi").strip_ansi.len2
9
# a QR code to scan with your phone
10
qr("https://github.com/zbu1/zil")
█████████████████████████████████████ █████████████████████████████████████ ████ ▄▄▄▄▄ █▄ █▄▄▄ █▄██ █ ▄▄▄▄▄ ████ ████ █ █ █▄▀▄ █▄█▀▀ █▄▀█ █ █ ████ ████ █▄▄▄█ █▀▀▀▄▄▀▀▄ ▀ ███ █▄▄▄█ ████ ████▄▄▄▄▄▄▄█▄▀ ▀▄▀▄█▄█ ▀▄█▄▄▄▄▄▄▄████ ████▄▀ ▀██▄▄▀ ▄ ▄█▄ ▀▀ ▀▀ ██▄▀ ████ ████▄▀█▄▀▀▄▄ █ ▄▄ ▀ █▄ ▄▀▄▄ ▄█▄████ ████ ▄▀▄▀ ▄ ▀▄▀▄█ ██▀█▀▀█ ███▀ ████ ████▄▄ ▀▄▀▄▀▄ ▄▄▀█▄█▄ ▀▄ ▄███▄████ ████▄█▀▄█ ▄▄██ █▄█▄ ▀█▀▄▄ ▀██▀▀ ████ ████▄▄██▀█▄▀█▄▄ ▄ ▀ ▄█▄▀█▀█ ▄██▄████ ████▄▄█▄▄█▄█ █▀█▄ ██ ▄█ ▄▄▄ ▀▄▀████ ████ ▄▄▄▄▄ █▄█▀ ▄▀█▄█▀█▀ █▄█ ██▀ ████ ████ █ █ ███▀█ ▄█▄ ▄█ ▄▄ ▀ █████ ████ █▄▄▄█ █▄▀ ▄▀█▀ ▄ █▀▄█▀ ▀█▄▄████ ████▄▄▄▄▄▄▄█▄█▄█▄▄▄██▄▄█▄███▄▄██▄████ █████████████████████████████████████ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
11
# a big clock
12
segments(now.format("%H:%M"))
▄▄ ▄▄ █ ▄▄█ • █ ▄▄█ █ █▄▄ • █ █▄▄
Example outputCtrl+Enter to run

Example results generated on 2026-11-04. Ones using now, today or randomness will differ when you run them.