← All libraries

CandyFreeze

📸 CandyFreeze

Code → SVG screenshot generator

port of freeze svg screenshots no-gd ansi

Turn code or terminal output into an SVG screenshot. No ext-gd / Imagick — output is plain text suitable for git diffs and CI artifacts. ANSI SGR (16 / 256 / 24-bit truecolor + bold / italic / underline) becomes <tspan> in the SVG.

Install

composer require candycore/candy-freeze

Quickstart

use CandyCore\Freeze\SvgRenderer;

$svg = SvgRenderer::dracula()
    ->withLineNumbers(true)
    ->withWindow(true)
    ->withPadding(24)
    ->render($code);

file_put_contents('out.svg', $svg);

// ANSI input is honoured — SGR colours become <tspan> segments.
$svg = SvgRenderer::dark()
    ->render("\x1b[31merror:\x1b[0m something broke");

What's in the box

Pure-PHP SVGNo raster pipeline. The output is a text file — diffable, grep-able.
Window chromemacOS-style traffic-light controls, optional drop shadow, configurable border radius.
Line numbersOptional left-gutter line counter.
Five themesdark, light, dracula, tokyo-night, nord.
ANSI honouredPipe coloured terminal output through; SGR sequences become tspan colour spans.
CLI + librarycandyfreeze input.php -o out.svg, or SvgRenderer::dracula()->render($code).

Source & demos

Try the quickstart →

Demos.

VHS-recorded GIFs of every example shipped with the library. Regenerated automatically on every push that touches the source.

Screenshot

Screenshot

Code → SVG with traffic-light chrome + line numbers.