Crate aasvg

Crate aasvg 

Source
Expand description

§aasvg - ASCII Art to SVG

Convert ASCII art diagrams to SVG with automatic light/dark mode support.

This library renders ASCII diagrams using CSS variables, so the output automatically adapts to the user’s color scheme preference.

§Example

use aasvg::render;

let diagram = r#"
    +-----+
    |     |
    +-----+
"#;

let svg = render(diagram);
println!("{}", svg);

§Supported Elements

  • Lines: -, |, /, \, =, ~, _
  • Vertices: +, ., ', ,, `
  • Arrows: >, <, ^, v, V
  • Points: o, *, , , , ,
  • Jumps: (, ) for line crossings
  • Text: Any other characters are rendered as text

§Light/Dark Mode

The generated SVG includes CSS that uses prefers-color-scheme to automatically switch colors based on the user’s system preference.

Structs§

RenderOptions
Options for rendering ASCII diagrams to SVG.

Functions§

render
Render an ASCII art diagram to SVG.
render_with_options
Render an ASCII art diagram to SVG with custom options.