carbon-now-cli is a free, open source frameworks & platforms project written in TypeScript and released under MIT. It has 6,034 GitHub stars, 126 forks and 8 open issues, and was last pushed 10 months ago. On this registry it ranks #31 of 44 tracked projects in Frameworks & Platforms, with 5 head-to-head comparisons available.

What is carbon-now-cli?

carbon-now-cli is a TypeScript command-line tool that turns source code into Carbon-style images straight from the terminal, built for developers who need presentable code snippets for docs, slides, and social posts without opening a browser.

What it is

carbon-now-cli is a Node.js CLI published under the MIT licence that wraps the Carbon image generator (carbon.now.sh) in a terminal interface. It is written in TypeScript, sits in the Developer Tools / Frameworks & Platforms category, and carries 6,034 stars, 126 forks, and 8 open issues, with the most recent push to the repository on 14 November 2025. All functionality is driven by flags such as --interactive, --preset, and --to-clipboard, so the same tool serves both one-off image generation and scripted batch runs.

The concrete problem it solves is the round trip through the Carbon web app. Producing a code image the manual way means opening carbon.now.sh in a browser, pasting the snippet, adjusting the theme, then screenshotting or downloading the result and saving it somewhere sensible. This project replaces that workflow with a single command that reads from a file path, stdin, or the clipboard, and downloads the real, high-quality image rather than capturing a DOM screenshot. File type detection, export format, and resolution are handled for you, and the interactive mode covers everything that needs a human decision.

Key capabilities

  • Accepts input from a file argument, from stdin (for example pbpaste | carbon-now), or from the clipboard via --from-clipboard.
  • Detects file type automatically and ships an extensions map that covers all languages plus additional file types beyond the common set.
  • Offers --interactive mode for full customization before generation, and --preset to save and re-use favourite settings.
  • Processes selected line ranges only, using --start and --end.
  • Copies the finished image to the clipboard cross-OS with --to-clipboard, or saves it via --save-to and --save-as, or opens it in the browser with --open-in-browser.
  • Exports png and svg at 1x, 2x, or 4x resolutions, with support for custom theme colours.
  • Selects the rendering engine with --engine (chromium, firefox, or webkit) and runs Playwright in headful mode with --disable-headless, while --skip-display suppresses inline display in supported terminals.

Who uses it and how

  • Developers writing tutorials, README files, and conference slides who need consistent code imagery without leaving the shell.
  • Maintainers producing many images at once, using the built-in concurrency support for batch processing across a directory of snippets.
  • Automation and CI workflows, where the tool runs headless by default or is invoked through npx carbon-now-cli without a global install.
  • Teams standardizing the visual style of published snippets by keeping a shared read-only config file and applying it with --config.
  • Terminal users on any supported OS piping clipboard contents in and copying the rendered image straight back out, useful for chat and issue threads.

Getting started

Install globally with npm i -g carbon-now-cli, or use yarn global add carbon-now-cli, pnpm i -g carbon-now-cli, or bun i -g carbon-now-cli; running npx carbon-now-cli works without any installation at all. A Node.js runtime is required, and the flags reference Playwright browser engines, so a rendering engine is part of the runtime setup.

How it compares

No directly comparable terminal-native alternatives are named in the facts, so within this registry the project stands alone as the command-line counterpart to Carbon. Carbon itself is the web application it drives rather than a competing tool: the web app is the interactive interface, and carbon-now-cli is the scriptable, clipboard-aware, batch-capable path to the same class of output.

When to use it β€” and when not to

A self-hoster or local user must operate a Node.js environment plus the Playwright rendering engines, with chromium as the default and firefox or webkit available as alternatives, which is the main weight this tool adds to a machine. Anyone who cannot run headless browser machinery, or who needs pure server-side image generation with no browser in the loop, should look elsewhere. The other honest caveat is documentation depth: the configuration surface exposed by --config and --settings is the thinnest part of the README, so scripted users should expect to read the repository rather than the documentation page to pin down exact behaviour.

project readme (upstream, from github) β€” read inline

Carbon CLI

🎨 Beautiful images of your code β€” from right inside your terminal.

Build Status Code style Featured in awesome-nodejs Twitter Stargazers Maintenance Requirements MIT license

Table of Contents

Description

carbon-now-cli brings the power of Carbon directly to your terminal. ⚑️

Generate beautiful images of your code with a single command.

Want to customize everything before generating the image? Run it in --interactive mode. πŸ’…

Basic example

Features

  • πŸ–Ό Downloads the real, high-quality image (no DOM screenshots)
  • ✨ Detects file type automatically
  • πŸ—‚ Supports all languages & covers extra ground
  • ⚑️ Interactive mode via --interactive
  • πŸŽ’ Presets via --preset to save and re-use your favorite settings
  • πŸ–± Selective processing via --start and --end
  • πŸ“Ž Copies image to clipboard via --to-clipboard (cross-OS 😱)
  • πŸ“š Accepts file, stdin, or clipboard content as input
  • πŸ–‹οΈ Supports custom theme colors
  • πŸ₯ž Supports concurrency for easier batch processing
  • πŸ‘€ Saves to given location or opens in browser for manual finish
  • 🐢 Displays image directly in supported terminals
  • 🌈 Supports different export types (png, svg)
  • πŸ“ Supports different resolutions (1x, 2x, 4x)
  • ⏱ Reports each step and therefore shortens the wait
  • βœ… Heavily tested
  • ⛏ Actively maintained
  • 🧺 …and more!

Installation

Bun

bun i -g carbon-now-cli

pnpm

pnpm i -g carbon-now-cli

npx

npx carbon-now-cli <file>

npm

npm i -g carbon-now-cli

yarn

yarn global add carbon-now-cli
Requirements

Requirements

Usage

Beautiful images of your code β€” from right inside your terminal.

Usage
  $ carbon-now <file>
  $ pbpaste | carbon-now
  $ carbon-now --from-clipboard

Options
  --start, -s          Starting line of input
  --end, -e            Ending line of input
  --interactive, -i    Interactive mode
  --preset, -p         Apply an existing preset
  --save-to            Image save location, default: cwd
  --save-as            Image name without extension, default: original-hash
  --from-clipboard     Read input from clipboard instead of file
  --to-clipboard       Copy image to clipboard instead of saving
  --open-in-browser    Open in browser instead of saving
  --config             Use a different, local config (read-only)
  --settings           Override specific settings for this run
  --disable-headless   Run Playwright in headful mode
  --engine             Use different rendering engine, default: `chromium`
                       Options: `chromium`, `firefox`, `webkit`
  --skip-display       Don’t display the image in the terminal

Examples
  See: https://github.com/mixn/carbon-now-cli#examples

Presets

Creating a Preset

Running the carbon-now command generates a ~/.carbon-now.json config file.

Presets are stored in this file and consist of available settings. You can create presets either manually or automatically via the --interactive flag. When prompted, answer the following:

Presets 1

For example, naming the preset presentation will add it to ~/.carbon-now.json like this:

{
  "latest-preset": {
    // Equal to `presentation` below
  },
  "presentation": {
    "theme": "base16-light",
    "backgroundColor": "white",
    "windowTheme": "none",
    "windowControls": true,
    "fontFamily": "Space Mono",
    "fontSize": "18px",
    "lineNumbers": false,
    "firstLineNumber": 1,
    "selectedLines": "*",
    "dropShadow": false,
    "dropShadowOffsetY": "20px",
    "dropShadowBlurRadius": "68px",
    "widthAdjustment": true,
    "width": "20000px",
    "lineHeight": "140%",
    "paddingVertical": "35px",
    "paddingHorizontal": "35px",
    "squaredImage": false,
    "watermark": false,
    "exportSize": "2x",
    "type": "png"
  }
}

latest-preset will be overwritten after each run, while presentation remains until manually deleted.

Using a saved preset

To use a saved preset, simply run:

carbon-now _unfold.js --preset <name-of-preset>

If the preset or ~/.carbon-now.json does not exist, carbon-now-cli will fall back to the default settings and be smart about the rest.

Result:

Presets 1

Settings

interface CarbonCLIPresetInterface {
  backgroundColor: string;
  dropShadow: boolean;
  dropShadowBlurRadius: string;
  dropShadowOffsetY: string;
  exportSize: '1x' | '2x' | '4x';
  firstLineNumber: number;
  fontFamily: CarbonFontFamilyType;
  fontSize: string;
  lineHeight: string;
  lineNumbers: boolean;
  paddingHorizontal: string;
  paddingVertical: string;
  selectedLines: string; // All: "*"; Lines 3-6: "3,4,5,6", etc.
  squaredImage: boolean;
  theme: CarbonThemeType;
  type: 'png' | 'svg';
  watermark: boolean;
  widthAdjustment: boolean;
  windowControls: boolean;
  windowTheme: 'none' | 'sharp' | 'bw';
  custom?: CarbonThemeHighlightsInterface;
  width?: string;
  // Below are detected automatically, and not persisted as keys
  language?: string;
  titleBar?: string;
}

Also see CarbonFontFamilyType, CarbonThemeType & CarbonThemeHighlightsInterface

Re-using settings

It just works. β„’

carbon-now automatically reuses settings from previous runs, so you don’t need to worry about manually reconfiguring them.

Presets 3

Custom theme colors

From v2.0, carbon-now-cli supports custom theme colors for detailed styling. Define a custom key inside a preset that complies to the following type:

interface CarbonThemeHighlightsInterface {
  background?: string;
  text?: string;
  variable?: string;
  variable2?: string;
  variable3?: string;
  attribute?: string;
  definition?: string;
  keyword?: string;
  operator?: string;
  property?: string;
  number?: string;
  string?: string;
  comment?: string;
  meta?: string;
  tag?: string;
}

Example ~/.carbon-now.json with custom theme colors:

{
  "hacker": {
    "backgroundColor": "rgba(0, 255, 0, 1)",
    "windowTheme": "bw",
    "windowControls": true,
    "fontFamily": "Anonymous Pro",
    "fontSize": "18px",
    "lineNumbers": false,
    "firstLineNumber": 1,
    "dropShadow": false,
    "selectedLines": "*",
    "dropShadowOffsetY": "20px",
    "dropShadowBlurRadius": "68px",
    "widthAdjustment": true,
    "lineHeight": "133%",
    "paddingVertical": "30px",
    "paddingHorizontal": "30px",
    "squaredImage": false,
    "watermark": false,
    "exportSize": "2x",
    "type": "png",
    "custom": {
      "background": "rgba(0, 0, 0, 1)",
      "text": "rgba(0, 255

readme truncated β€” read the full docs on github

Frequently asked questions

Is carbon-now-cli free to use?

carbon-now-cli is open source under the MIT licence. There is no licence fee and no seat count β€” you can self-host it or, where the project offers one, pay a vendor for a managed version instead.

What does carbon-now-cli do?

🎨 Beautiful images of your code β€” from right inside your terminal.

What is carbon-now-cli written in?

carbon-now-cli is primarily written in TypeScript. Its source is publicly available at https://github.com/mixn/carbon-now-cli, and it has 6,034 GitHub stars.