Skip to content

Latest commit

 

History

History

ansi2-wasm

Parse ansi strings and convert them to html and svg formats

install

It is recommended to use npm, it will compress svg using svgo

npm i ansi2 -g
cargo binstall ansi2
cargo install ansi2 --features="cli"

usage

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
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

options

format

neofetch | ansi2 --format=html > neofetch.html
neofetch | ansi2 --format=svg > neofetch.svg

theme

vga / vscode / ubuntu

neofetch | ansi2 --format=svg --theme=vscode > neofetch.svg

font

neofetch | ansi2 --format=svg --font=./font.ttf > neofetch.svg

mode

dark / light

neofetch | ansi2 --format=svg --mode=dark > neofetch.svg

example

neofetch

vitest