https://github.com/nonk123/vga9x16
An API for generating ASCII-art blobs
https://github.com/nonk123/vga9x16
api ascii ascii-art dwarf-fortress png rocket rust
Last synced: about 1 month ago
JSON representation
An API for generating ASCII-art blobs
- Host: GitHub
- URL: https://github.com/nonk123/vga9x16
- Owner: nonk123
- License: unlicense
- Created: 2025-03-26T11:14:46.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2025-03-26T12:19:57.000Z (about 1 year ago)
- Last Synced: 2025-03-26T13:22:16.859Z (about 1 year ago)
- Topics: api, ascii, ascii-art, dwarf-fortress, png, rocket, rust
- Language: Rust
- Homepage:
- Size: 21.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# vga9x16
[See the live demo](https://vga9x16.ru).
A simple HTTP API serving a very specific usecase:
- You need a randomly generated blob of Dwarf Fortress styled ASCII-art.
- It needs to be somewhat unique for each request.
- It has to be in PNG format so you can use it as a CSS background.
## Usage
Run the development server with `cargo run`.
For deployment, use this sample `docker-compose.yml`; then point your reverse-proxy ([I recommend caddy](https://caddyserver.com/)) to `vga9x16:8000`:
```yaml
services:
main:
container_name: vga9x16
image: ghcr.io/nonk123/vga9x16:release
restart: always
networks:
- add your reverse-proxy network here...
```
Navigate to `/` for an example background image usage. The `/png` route returns the sought-after ASCII-art blob. Pass `?transparent=true` for a transparent background instead of black.
## Under the hood
Here are some implementation details for the curious:
- The ASCII-art PNG is updated every second. Two users reaching `/png` at around the same time will get duplicate blobs.
- You can set `VGA9X16_PUBLIC=1` at build time to return [index.public.html](index.public.html) for the `/` route.
## Attribution
Links to where the assets were borrowed from:
- [9x16.png](https://dwarffortresswiki.org/index.php/Tileset_repository#9.C3.9716).
- [favicon.avif](favicon.avif) - trimmed from [9x16.png](9x16.png) and reexported to AVIF.