Transform your code snippets into stunning, shareable images with elegant design, flawless performance and professional highlighting.
import { writeFile } from "node:fs/promises";
import { codeToImg } from "flashot";
const buffer = await codeToImg('console.log("hello, world!");', {
theme: "monokai",
format: "png",
style: { borderRadius: 16, padding: 24 }
});
await writeFile("inline.png", buffer);
Install via your favorite package manager and start generating beautiful code images instantly
$ npm install flashot
$ npx jsr add @thuongtruong/flashot
$ yarn add flashot
$ bun install flashot
$ npm install -g flashot
$ flashot code "console.log('Hello world')" -o hello.png
Everything you need to create professional, shareable code visuals with stunning themes and pixel-perfect quality
JavaScript, TypeScript, Python, Java, C++ and more with perfect syntax highlighting
GitHub Dark, Dracula, Monokai, Solarized and many beautiful themes
Export as PNG, JPEG, WebP, AVIF with custom quality settings
Optimized rendering with caching, generates images in ~135ms
Control fonts, padding, border radius, line numbers and colors
Works with ESM and CommonJS with TypeScript definitions
Use as Node.js package or command-line tool for any workflow
Generate crisp, professional images perfect for documentation
Display and customize line numbers with custom colors
Advanced highlighting with custom backgrounds and effects
Support for inline code, file paths, URLs, and buffer data
MIT licensed with comprehensive documentation and community
Leveraging the best tools for performance, reliability and developer experience