A frame as an SVG picture: for an email, a README, a social preview, or
anywhere an image goes and a <pre> cannot.
{:ok, frame} = Ascii.still("night-coast")
File.write!("night-coast.svg", Ascii.Render.SVG.render(frame, title: "a lighthouse"))Each row is text, in runs of one colour, each run placed at its column
and held to its width, so the columns line up in whatever monospace font
the reader has. A coloured piece is drawn over its ground; a frame
without colours, and cells in no coloured part, take :foreground. A CSS
variable in the palette (see Ascii.Ink) stays one, so an SVG inlined
in a page takes the page's colours; on its own, it shows the fallback.
Spaces are left out: an SVG is about the size of the frame's text.
Options
:font_size- in pixels (default 14). A cell is 0.6 of it wide, the shape of most monospace fonts, and as tall as the piece'scellsays (1.2 of it for a character's shape), as the browser's canvas draws.:font_family- the font (default a stack of system monospace fonts).:foreground- the colour of uncoloured text (default"currentColor", the colour of the text around an inline SVG; black in a file of its own).:background- a colour behind the picture. Defaults to the piece's ground, if it is drawn in colour over one; else none.:title- what the picture shows, for screen readers and as its tooltip: seeAscii.describe/1.
Summary
Functions
The frame as an SVG document, as iodata.
Types
Functions
@spec render(frame :: Ascii.Frame.t(), opts :: [option()]) :: iodata()
The frame as an SVG document, as iodata.