npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@codeimage/cli

v1.0.1

Published

Generate beautiful code images from the command line

Readme

@codeimage/cli

Generate beautiful code images from the command line! 🎨

Installation

# Install globally
npm install -g @codeimage/cli

# Or use with npx
npx @codeimage/cli generate file.js

Quick Start

# Generate image from file
codeimage generate file.js

# Generate image from code snippet
codeimage generate "console.log('Hello World!')" --language javascript

# Generate with custom theme and frame
codeimage generate file.js --theme dark --frame clerk

# Interactive mode
codeimage interactive

Commands

generate <input>

Generate a code image from file, code snippet, or URL.

Options:

  • -t, --theme <theme> - Theme (dark, light, auto, github, monokai, dracula)
  • -f, --frame <frame> - Frame style (tailwind, clerk, mintlify, minimal, macos)
  • -l, --language <language> - Programming language (auto-detect if not specified)
  • -o, --output <file> - Output file path
  • -s, --size <size> - Image size multiplier (1x, 2x, 3x)
  • -p, --padding <padding> - Padding around code (small, medium, large)
  • --width <width> - Custom width in pixels
  • --height <height> - Custom height in pixels
  • --background - Show background pattern (default: true)
  • --no-background - Hide background pattern
  • --share - Generate a shareable link

Examples:

# Basic usage
codeimage generate file.js

# With custom theme and frame
codeimage generate file.js --theme dracula --frame clerk

# Generate from code snippet
codeimage generate "function hello() { console.log('world'); }" --language javascript

# High resolution with custom padding
codeimage generate file.js --size 3x --padding large

# Generate shareable link
codeimage generate file.js --share

interactive

Launch interactive mode for guided image generation.

codeimage interactive

themes

List all available themes.

codeimage themes

frames

List all available frame styles.

codeimage frames

Themes

  • dark - Dark theme with syntax highlighting
  • light - Light theme with syntax highlighting
  • github - GitHub-style theme
  • monokai - Monokai color scheme
  • dracula - Dracula color scheme
  • auto - Auto-detect based on system preference

Frame Styles

  • tailwind - Clean Tailwind-style frame
  • clerk - Dark Clerk-style frame
  • mintlify - Mintlify documentation style
  • minimal - Minimal borderless frame
  • macos - macOS window style

Supported Languages

Auto-detection supports:

  • JavaScript/TypeScript
  • Python
  • Java
  • C#/C++
  • Go
  • Rust
  • PHP
  • Ruby
  • Swift
  • Kotlin
  • HTML/CSS
  • SQL
  • JSON/YAML
  • Markdown
  • And more!

Examples

Generate from File

codeimage generate src/components/Button.tsx --theme dark --frame tailwind

Generate from Code Snippet

codeimage generate "const hello = () => console.log('world');" --language javascript --theme monokai

High Resolution Export

codeimage generate file.js --size 3x --output high-res-code.png

Generate Shareable Link

codeimage generate file.js --share
# Output: https://codeimage.com/share?code=...

Configuration

You can create a .codeimagerc file in your project root:

{
  "theme": "dark",
  "frame": "tailwind",
  "size": "2x",
  "padding": "medium",
  "background": true
}

Integration

CI/CD Pipeline

# GitHub Actions example
- name: Generate code images
  run: |
    npm install -g @codeimage/cli
    codeimage generate src/ --output docs/images/

Package.json Scripts

{
  "scripts": {
    "generate-images": "codeimage generate src/ --output docs/",
    "screenshot-code": "codeimage interactive"
  }
}

API

The package also exports a programmatic API:

const { generateImage } = require('@codeimage/cli');

const result = await generateImage('console.log("hello");', {
  theme: 'dark',
  frame: 'tailwind',
  language: 'javascript',
  output: 'output.png'
});