PokeStats
April 15, 2026 · View on GitHub
PokeStats
Pokemon stats fetch for the terminal.
Features • Install • Usage • Termux • How it works • License
Features
- Random or by name —
pokestatsfor a random Pokemon,pokestats pikachufor a specific one - Color-coded stat bars — each stat gets its own color (red HP, orange ATK, blue SpAtk, etc.)
- Pokemon type badges — shows type(s) on a dedicated line with colored icon badges (e.g.
[✿ Grass] [☠ Poison]) - Pokedex ID — zero-padded ID next to the name (
#025,#006) - Unicode icons — works without Nerd Fonts or special icon packs
- Variant fallback — if
urshifu-single-strikehas no sprite, falls back tourshifu - Graceful retries — random mode retries up to 5 times if a sprite is unavailable
- Color auto-detection — disables colors when piped or the terminal doesn't support them
- Termux / mobile layout — auto-detects Termux and switches to a stacked, compact layout
- Side-by-side centering — sprite and info panel are vertically centered on desktop
Installation
Quick install
git clone https://github.com/mdatz/pokestats.git
cd pokestats
./install.sh
The installer detects your package manager, checks for missing dependencies, and installs everything to ~/.local/bin/pokestats. Pass --yes to skip confirmation prompts.
Dependencies
| Dependency | Why | Install |
|---|---|---|
| bash 4.0+ | Shell (arrays, arithmetic, etc.) | Pre-installed on most systems |
| curl | HTTP requests to PokeAPI | sudo apt install curl / brew install curl |
| jq | JSON parsing | sudo apt install jq / brew install jq |
| perl | Stripping ANSI escape codes | Usually pre-installed; pkg install perl on Termux |
| pokeget | Renders Pokemon sprites | See below |
pokeget is the only one you're likely to need to install manually:
Installing pokeget
pokeget renders the colored Pokemon sprites in your terminal. It's a Rust binary — fastest install is via cargo:
cargo install pokeget
No Rust? Download a pre-built binary from github.com/riffl/pokeget/releases and put it somewhere in your $PATH.
Manual install
If you'd rather skip the installer:
cp script.sh ~/.local/bin/pokestats
chmod +x ~/.local/bin/pokestats
Make sure ~/.local/bin is in your $PATH:
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
Usage
pokestats # random Pokemon (Gen 1-8)
pokestats pikachu # by name
pokestats 25 # by Pokedex ID
pokestats --termux # force stacked mobile layout
pokestats --color-test # preview stat bar colors
pokestats --version # print version
pokestats --help # show usage
Examples
# Morning routine: who's your random Pokemon today?
pokestats
# Look up your favorite
pokestats gengar
# By Pokedex number
pokestats 150
# Pipe-friendly (no colors, no ANSI)
pokestats snorlax | cat
# Preview stat bar colors
pokestats --color-test
Termux
Pokestats automatically detects Termux and switches to a stacked layout optimized for narrow screens:
The sprite is centered on screen, stats are displayed in a compact 2-column grid, and bars are shortened to fit mobile viewports. Detection is automatic via $PREFIX or $TERMUX_VERSION — or force it on desktop with --termux.
Install on Termux
pkg install curl jq perl rust
cargo install pokeget
git clone https://github.com/mdatz/pokestats.git
cd pokestats
./install.sh
How it works
- Picks a random Gen 1-8 Pokemon (ID 1-905) or resolves your input
- Fetches data from PokeAPI — stats, abilities, types, ID
- Renders the sprite via
pokegetwith ANSI colors - Displays sprite + info panel side-by-side (desktop) or stacked (Termux)
Fallback chain
If a Pokemon has a variant name like urshifu-single-strike and pokeget doesn't have that specific sprite, pokestats tries the base form (urshifu) automatically. In random mode, if both the exact and base names fail, it picks a new random Pokemon and retries (up to 5 times).
Gen limitations
Random Pokemon are limited to IDs 1-905 (Gen 1-8) because pokeget doesn't have Gen 9 sprites yet. You can still look up Gen 9 Pokemon by name — PokeAPI will return their data, but the sprite will fall back or fail gracefully.
Customization
Edit the config block at the top of script.sh:
| Variable | Default | What it does |
|---|---|---|
SPRITE_WIDTH | 38 | Horizontal space reserved for the sprite column |
PADDING_H | 1 | Extra vertical nudge for centering |
PADDING_W | 0 | Extra horizontal padding |
BAR_WIDTH | 12 | Stat bar length in characters |
MAX_RETRIES | 5 | Max random retries before giving up |
License
MIT — see LICENSE.