# Owner: glow
# KeyID: E65A8520F36AEE13CFE4F56BEB8FE331063A4794
# Key: https://glow.li/pgp
# Verify: curl "https://glow.li/posts/pkmn/index.html.asc" | gpg
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
+++
{
"css": ["iframe.css"],
"date": "2023-05-25",
"description": "I converted all Pokémon sprites to ANSI, so you can view them in you terminal (or browser)",
"layout": "post",
"sharingimage": "media/images/pkmn-preview",
"tags": [
"Technology",
"Showcase",
"Terminal",
"Web_Development",
"Project",
"CLI"
],
"title": "pkmn.li: Pokémon sprites in your terminal"
}
+++
I converted all Pokémon sprites to ANSI, so you can view them in you terminal (or browser).
Get a random Pokémon in your terminal:
```
curl = pkmnUrl() ?>
```
Get a specific Pokémon:
```
curl = pkmnUrl(false,"25/"); ?>
```
You can also view it in the browser: [= pkmnUrl() ?>](= pkmnUrl(true) ?>)
You will need [true color support](https://github.com/termstandard/colors#fully-supporting) in your terminal.
## Data
I am using the [PokeAPI sprites](https://github.com/PokeAPI/sprites) for the images and the [PokeAPI api-data](https://github.com/PokeAPI/api-data) for the flavor text (Pokédex entries). I am generating all Pokémon from the static data in the repositories. I am not actually using the PokeAPI.
## Creating ANSI from the sprites
To create the ANSI from the sprites I am using the Rust program [viu](https://github.com/atanunq/viu).
Generating html from ANSI is actually rather difficult. Unlike with [= aareUrl(); ?>](= postUrl('aare.li'); ?>), where I am using [ansi-escape-to-html](https://github.com/neilime/ansi-escapes-to-html) directly in the PHP script, this doesn't work with the Pokémon sprites as they are true color (24 million colors). I haven't found a php package that supports true color ANSI. But the Python package [ansi2html](https://github.com/pycontribs/ansi2html) does, so I am using that.
-----BEGIN PGP SIGNATURE-----
iQIyBAEBCgAdFiEE5lqFIPNq7hPP5PVr64/jMQY6R5QFAmSbVIwACgkQ64/jMQY6
R5QP+g/463GzLXx7R12sGIYriuHIIqRQDHWf20au1qKg1Dk4rV6kUjU9sbhEUHWR
2FW9LdcfhbJCqtcNOROrA899QUXcLSggVU3eZZINvtLNkE3sDdKfpLs6uAAz3ZaM
XJJFzVJgdjOa+yJLZDWkAO5nS/nk1ftFcceMACiyD8//evokJCmp1hmOrDbsk3mS
ik6RS6r2u8UrwQEGuVRlze1aRawMqW1Nqrl0oZdFpCVNNVxfy8tujimPma6m6zp/
8eeR/EGAXwpkjRLcBEQeAnQm6F6KYOD3OON69EvddlZpoDXZAzOP/Pb2TGIiiT3A
P8QVJobLegxCUQRNEqBbdtk3ZU1y07smlaX54oTxOtJL/QC65GcjePinJy8OIAuW
k1vfu3qUNYxbS0YgsNThYvs9a2ihRuDtMNduCdzedA+kyQOGsUGx/LpRhE7Daekm
t/SKXxEvGrwqCZ5yzJ+EpSWv0rQXuoVgBEm6ewybkKFyf0BuIZYXAYvPf8yDenz2
g88hPIGYd6z6sqQGzr4v2sv5yNzlPbexwbWTUR7KB89WaY3than5UdSyeOfTceXR
LRGQdj+YwyVKKy+UlNtSJHI4bvb1cAJs6cZmUabYVEO8ed5mYmod1ZaF25HTz8t7
bNto2DrKDrxjq2V3fSCdsi9MDCj2EbjoPIz0zFHepDWNRBccOg==
=X8aO
-----END PGP SIGNATURE-----