Skip to content

Sibikrish3000/pokemon-colorscripts-rs

Repository files navigation

Pokémon Colorscripts Rust (pokemon-rs)

An ultra-fast, dependency-free Rust implementation of the original Pokémon colorscripts. Optimized for "Absolute Mode" terminal performance.


⚡ Performance: Python vs. Rust

Feature Original (Python) Pokémon-RS (Rust)
Startup Latency ~60ms <6ms
Data Loading Disk I/O (Slow) Compiled into Binary (Instant)
Dependencies Python 3 Zero (Standalone Binary)
Memory Footprint ~30MB <2MB

🚀 Description

This is a high-performance port of Phoney Badger's Pokémon colorscripts. It prints colored Unicode sprites of Pokémon directly to your terminal.

Key Improvements:

  • Embedded Assets: All 900+ Pokémon sprites and metadata are baked into a single binary using rust-embed. No external folders required.
  • Binary Optimization: Compiled with LTO (Link-Time Optimization) and stripped of debug symbols for sub-millisecond execution.
  • Safety: Memory-safe Rust implementation with compile-time JSON validation.

🛠 Installation

1. Arch Linux (AUR)

Install the high-performance Rust version via your favorite AUR helper:

yay -S pokemon-colorscripts-rs-git

2. Manual Install (WSL/Linux/MacOS)

Download the optimized binary directly to your local bin:

curl -sS https://raw.githubusercontent.com/Sibikrish3000/pokemon-colorscripts-rs/master/install.sh | bash

3. Build from Source

Ensure you have cargo installed:

git clone https://github.com/Sibikrish3000/pokemon-colorscripts-rs.git
cd pokemon-colorscripts-rs
cargo build --release
# Binary located at target/release/pokemon-rs

📖 Usage

usage: pokemon-rs [OPTION] [POKEMON NAME]

Options:
  -n, --name <NAME>    Select Pokémon by name (e.g., 'charizard', 'mr-mime')
  -f, --form <FORM>    Show alternate form (e.g., 'defense', 'alola')
  -r, --random         Show a random Pokémon (can specify gen: 1-8)
  -s, --shiny          Force shiny version
  -b, --big            Show larger sprite
  --no-title           Hide the Pokémon name
  -l, --list           List all available Pokémon

Examples

  • Random Pokémon: pokemon-rs -r
  • Specific Shiny: pokemon-rs -n gengar -s
  • Large Form: pokemon-rs -n deoxys --form attack -b

🖥 Terminal Integration

Zsh / Bash

Add this to your .zshrc or .bashrc for a zero-lag greeting:

# Using the Rust binary ensures NO shell startup delay
pokemon-rs -r --no-title | fastfetch --logo -

PowerShell

Add to your $PROFILE:

[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
pokemon-rs.exe -r --no-title

🧬 How it Works

Unlike the Python version which reads from the disk on every execution, pokemon-rs uses Zero-Cost Abstractions:

  1. Compile-Time Embedding: The colorscripts/ directory is mapped into the binary's data segment.
  2. Static JSON: The Pokémon database is parsed once during compilation and stored as a static lookup table.
  3. No Runtime Bloat: No interpreter, no garbage collector, just raw machine code.

📜 Credits & License

License: MIT

About

pokemon colorscripts in rust

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages