Esta página se muestra en inglés. Una traducción al español está en curso.
ConfigsMay 17, 2026·2 min de lectura

Carbon — Create Beautiful Images of Your Source Code

A web application that generates aesthetically styled screenshots of source code with syntax highlighting, custom themes, and export options.

Listo para agents

Este activo puede ser leído e instalado directamente por agents

TokRepo expone un comando CLI universal, contrato de instalación, metadata JSON, plan según adaptador y contenido raw para que los agents evalúen compatibilidad, riesgo y próximos pasos.

Native · 98/100Política: permitir
Superficie agent
Cualquier agent MCP/CLI
Tipo
Skill
Instalación
Single
Confianza
Confianza: Established
Entrada
Carbon Overview
Comando CLI universal
npx tokrepo install 2a82ea11-51eb-11f1-9bc6-00163e2b0d79

Introduction

Carbon turns source code snippets into visually attractive images suitable for sharing on social media, documentation, or presentations. It renders code with syntax highlighting inside a styled window frame with configurable backgrounds, shadows, and padding.

What Carbon Does

  • Converts code snippets into PNG or SVG images with syntax highlighting
  • Applies window chrome styling (macOS-style traffic lights, title bar)
  • Supports 150+ programming languages via highlight.js and CodeMirror
  • Allows background customization with solid colors, gradients, or images
  • Provides direct sharing to Twitter or clipboard with one click

Architecture Overview

Carbon is a Next.js application using CodeMirror for the code editor and dom-to-image for image rendering. When a user pastes code, the React component tree renders it with the selected theme and styling. The export function captures the styled DOM node as a canvas, then converts it to PNG or SVG format for download.

Self-Hosting & Configuration

  • Clone the repo and run yarn install followed by yarn dev
  • Deploy to Vercel or any Node.js hosting with zero additional config
  • Pre-fill code via URL query parameters for shareable links
  • Embed carbon widgets in documentation using the iframe API
  • Environment variables configure default theme and language

Key Features

  • 30+ syntax themes including Dracula, Monokai, Solarized, One Dark
  • Adjustable padding, font size, line height, and window shadow
  • SVG export for resolution-independent images
  • URL state encoding for sharing configurations via link
  • Auto-language detection based on code content

Comparison with Similar Tools

  • Ray.so — Raycast-built alternative with fewer themes but cleaner UI
  • Chalk.ist — animated code snippet images with step-by-step reveal
  • Silicon — Rust CLI that generates images locally without a browser
  • Codeimg.io — similar concept with more social-media-oriented templates

FAQ

Q: Can I use Carbon from the command line? A: Yes, carbon-now-cli (npx carbon-now-cli file.py) opens a headless browser, renders the image, and saves it locally.

Q: What image formats are supported? A: PNG (default) and SVG. SVG preserves vector quality at any zoom level.

Q: How do I set a custom font? A: Select from available monospace fonts in the settings dropdown. Custom fonts require self-hosting.

Q: Is there a maximum code length? A: No hard limit, but very long snippets produce oversized images. Keep snippets focused for best results.

Sources

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.

Activos relacionados