| Crates.io | ansi2 |
| lib.rs | ansi2 |
| version | 0.3.0 |
| created_at | 2024-04-20 02:32:18.036862+00 |
| updated_at | 2025-06-25 03:42:34.03907+00 |
| description | ansi2 |
| homepage | |
| repository | https://github.com/ahaoboy/ansi2 |
| max_upload_size | |
| id | 1214291 |
| size | 884,153 |
Parse ansi strings and convert them to html and svg formats
It is recommended to use npm, it will compress svg using svgo
npm i ansi2 -g
cargo binstall ansi2
cargo install ansi2 --features="cli"
neofetch | ansi2 > ./neofetch.svg
neofetch | ansi2 --format=svg --theme=vscode > neofetch.svg
vitest bench --run | ansi2 --format=html --mode=light > bench.html
vitest bench --run | ansi2 --format=text > bench.txt
vitest bench --run | ansi2 --format=svg --mode=dark | resvg - -c > bench.png
cat ./assets/ghostty.png | ansi2 -f=ans
use ansi2::{Canvas};
let canvas = Canvas::new(s);
for row in canvas.pixels.iter() {
for pixel in row.iter() {
// draw pixel
}
}
npm i ansi2 -g
neofetch | ansi2 > ./neofetch.svg
neofetch | ansi2 --format=svg --theme=vscode > neofetch.svg
neofetch | ansi2 --format=html > neofetch.html
neofetch | ansi2 --format=svg > neofetch.svg
vga / vscode / ubuntu
neofetch | ansi2 --format=svg --theme=vscode > neofetch.svg
neofetch | ansi2 --format=svg --font=./font.ttf > neofetch.svg
dark / light
neofetch | ansi2 --format=svg --mode=dark > neofetch.svg