Generate beautiful code screenshots from ray.so via the command line.
# Clone and install
git clone https://github.com/kristianfreeman/rayshot.git
cd rayshot
npm install
# Link globally (optional)
npm link# Basic usage - pass code directly
rayshot "const x = 1;" -o screenshot.png
# From a file
rayshot ./snippet.ts --output screenshot.png
# With options
rayshot "console.log('hello')" --theme vercel --language javascript --name app.js
# Pipe from stdin
cat myfile.py | rayshot - --language python -o output.png
# Light mode
rayshot "const x = 1;" --light --theme candy| Option | Alias | Description | Default |
|---|---|---|---|
--theme |
-t |
Theme name | cloudflare |
--language |
-l |
Syntax highlighting language | typescript |
--output |
-o |
Output file path | ./rayshot.png |
--name |
-n |
Filename shown in header | none |
--padding |
-p |
Padding in pixels | 32 |
--dark |
-d |
Dark mode | true |
--light |
Light mode | ||
--list-themes |
List all available themes | ||
--list-languages |
List all available languages | ||
--help |
-h |
Show help |
cloudflare- Cloudflare (orange/dark)vercel- Vercel (black/white)supabase- Supabase (green/dark)tailwind- Tailwind CSS (blue)openai- OpenAI (black/green)stripe- Stripe (blue/purple)prisma- Prisma (teal)clerk- Clerk (purple)mintlify- Mintlify (green)elevenlabs- ElevenLabs (purple)resend- Resend (black/white gradient)triggerdev- Trigger.dev (purple)nuxt- Nuxt (green)browserbase- Browserbase (orange)gemini- Google Gemini (blue)
noir,mono,breeze,candy,crimson,falcon,meadow,midnight,raindrop,sunset,bitmap,ice,sand,forest
Run rayshot --list-themes for the full list.
Supports all major languages including:
typescript, javascript, python, swift, go, rust, java, kotlin, cpp, c, csharp, ruby, php, shell, sql, json, yaml, html, css, markdown, and more.
Run rayshot --list-languages for the full list.
rayshot 'const handler = async (req: Request) => {
return new Response("Hello from Workers!");
};' --theme cloudflare --name worker.ts -o tweet.pngrayshot ./Component.tsx --theme vercel --dark -o component.pngrayshot "def hello():
print('Hello, World!')" --theme supabase --language python -o hello.pngrayshot uses Playwright to:
- Open ray.so with your code and settings encoded in the URL
- Wait for the code frame to render
- Click the "Export" button
- Save the downloaded PNG
- Node.js 18+
- Chromium (automatically installed by Playwright)
MIT
