# 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.
## Other languages
If you want to have the names and flavor text in another language you can use the `lang` parameter:
```
curl = pkmnUrl(false,"?lang=de"); ?>
curl = pkmnUrl(false,"25/?lang=es"); ?>
```
- - [= pkmnUrl(false,"?lang=de") ?>](= pkmnUrl(true,"?lang=de") ?>)
- - [= pkmnUrl(false,"25/?lang=es") ?>](= pkmnUrl(true,"25/?lang=es") ?>)
The following languages are available:
- - `ja-Hrkt`
- - `roomaji`
- - `ko`
- - `zh-Hant`
- - `fr`
- - `de`
- - `es`
- - `it`
- - `en`
- - `cs`
- - `ja`
- - `zh-Hans`
- - `pt-BR`
## 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-----
iQIzBAEBCgAdFiEE5lqFIPNq7hPP5PVr64/jMQY6R5QFAmZaId8ACgkQ64/jMQY6
R5QlDQ//ZGauHBzU76H7LmVHTm5ZtziiaN33A91WsKCpWxRDYQAdz9S0uI8NqcLW
MaiejLb0rhRjmm2pZ89MGQUPOb0yFtN8ev/DfTyK4MUULgBlSTUbB23WH8v+Yi1Y
FSRl93MLRd6TEcRFGOtajnWtCOSgHSQClP/kXV0tbRvJMurpeIU6+j1Lq+kdZWuY
C0dBdAeUG3RaFEWGb8waaHUN1fhthNv6KlwXnX6mEmB7jYCq5RbFWHGsPAusT8U+
h9pRPY+I45ziGWb0irmHVFjVDNcYOgIfpUSNJM/65joTlDKQxX1dyC8kYC0BDGAo
W47pthdELb73svGscxsAaXfMxdh9w6w5hmLV0r1K5UvqmXJKTiIboZX13aIw9YoV
ZORaUz6fh0Yuwhvau83DBLsRwkAEfCJ1Ixz1rfKAH+OINKYJRJedDuKQclLAaECY
Z9+NhC/0miwE6RNempRLV7CdwsCJUL9P74Lz88ae9Qe9ru24/mphIgt4D4EfC/s9
7TwjXGaTX5Ag7np8rbp8SosGKfMEsl/OUxXt6yqQ8NS85+7ZsAIgIA4+ub4EO30v
BMtex9vO7EAac9PIWMT8mBOXrDQ8BtL2t5Q2kN2oqGuu2uKG/Xu8/gi054YRWclr
xX7knx1x74JEloZc4w2LFYJKvXaN0N3ngYAr3ad1GgPXfGTCGgM=
=ZqMt
-----END PGP SIGNATURE-----