- 🎲 Random Pokemon with 1/128 shiny chance
- ✨ Shiny variant support
- 🚀 Sprites embedded in binary (works offline)
- 📦 Single self-contained executable
- ⚡ Optimized for shell startup scripts
Mean time of random, measured with hyperfine -N over at least 2000 runs:
| Command | macOS 27, Apple Silicon | Linux x86_64 |
|---|---|---|
zigdex random |
1.10 ms | 0.22 ms |
pokeget random |
1.72 ms | 2.23 ms |
krabby random |
4.07 ms | 6.84 ms |
macOS
zigdex ▓▓▓░░░░░░░ 1.10ms ← 3.7x faster than krabby
pokeget ▓▓▓▓░░░░░░ 1.72ms
krabby ▓▓▓▓▓▓▓▓▓▓ 4.07ms
For reference, /usr/bin/true takes 0.72 ms and an empty compiled C program about 1.0 ms on the same Mac. Linux runs used pokeget 1.6.7 and krabby 0.3.0, pinned to one core.
brew tap Decryptu/tap
brew install zigdexNote: While zigdex is being reviewed for inclusion in Homebrew core, you can install it from my personal tap.
Download the appropriate binary for your architecture from the releases page and add it to your PATH.
zig build
zig build testThis will:
- Generate embedded sprites from your
assets/directory at compile time - Create a single executable at
zig-out/bin/zigdex - Embed all 1025 Pokemon sprites and 447 alternate forms directly into the binary
# Random Pokemon (1/128 chance for shiny)
zigdex random
zigdex --random
# Specific Pokemon by name
zigdex pikachu
zigdex bulbasaur charmander squirtle
# By Pokedex number
zigdex 25
zigdex 1 4 7
# Force shiny variant
zigdex pikachu --shiny
zigdex random --shiny
# Hide Pokemon name
zigdex pikachu --hide-name
zigdex random --hide-nameAdd to your .zshrc or .bashrc:
# Show random Pokemon on terminal start
zigdex --random --hide-name
# Or with fastfetch
alias fastfetch='zigdex --random --hide-name | command fastfetch --logo-type file-raw --logo -'Note: fastfetch is a fast system information tool similar to neofetch.
zigdex/
├── src/
│ ├── main.zig # Entry point and CLI
│ ├── args.zig # Argument parser
│ └── sprites.zig # Pokemon lookup and display
├── tools/
│ └── generate_sprites.zig # Build-time sprite embedder
├── assets/
│ ├── pokemon.json
│ └── colorscripts/
│ ├── regular/ # Normal sprites
│ └── shiny/ # Shiny variants
└── build.zig
- The
generate_sprites.zigtool runs during the build and replays each ANSI sprite into a pixel grid - Every sprite is stored as a palette plus two pixels per cell, with 256-color sprites converted to truecolor and transparent borders cropped
- Each Pokemon's regular and shiny sprites share one deflate stream, and all streams are embedded as a single blob
- At runtime the sprite is inflated and drawn with half blocks, emitting only the color changes each cell needs and resetting colors at every line end
- No runtime filesystem dependencies
- Binary size: ~1.2MB (fully self-contained)
- Seeded from OS entropy
- 1/128 chance for shiny (mimicking main series games)
- O(1) lookup by index
- Zero filesystem I/O at runtime
Supports multiple lookup methods:
- Case-insensitive name matching (
pikachu,PIKACHU,"Charizard (Mega X)") - Slug matching (
charizard-mega-x) - Pokedex number (
25,150)
Names and slugs are resolved with a binary search over a table sorted at build time. Unknown names are reported on stderr and make zigdex exit with status 1.
- Uses Zig's minimal entry point: no environment map, allocator or thread pool is set up
- Writes straight to the file descriptor instead of going through
std.Io, so on macOS dyld resolves only a handful of libSystem symbols at launch - Lookup tables store offsets rather than pointers, leaving almost nothing for dyld to rebase
- No heap allocation at runtime
- A handful of system calls per run, with the sprite written in a single
write
| Option | Short | Description |
|---|---|---|
--random |
-r |
Display random Pokemon (1/128 shiny) |
--shiny |
-s |
Force shiny variant |
--hide-name |
Don't print Pokemon name | |
--help |
-h |
Show help message |
- Zig 0.16.x
- Terminal with ANSI color support
- Pokemon sprite assets in
assets/directory
For the best experience, we recommend using:
Both terminals provide excellent ANSI color support and render Pokemon sprites beautifully.
MIT

