README.md

November 20, 2025 ยท View on GitHub

CodeImg

VSCode extension that generate beautiful image for you code and terminal with your favorite font and theme.

Powered by Solid.js.

Why another one?

The popular existing extensions lack maintenance and have limited customization options. I spent some weekend time creating this extension, hoping to add a more modern UI and additional configuration options.

How it works?

Call VSCode's built-in command to copy generated HTML text and render the parsed clipboard text content.

  • For code, use editor.action.clipboardCopyWithSyntaxHighlightingAction
  • For terminal, use workbench.action.terminal.copySelectionAsHtml

Browser Environment Limitation

Due to the limitation of navigator.clipboard.read() and lack of document.execCommand("paste") support in modern browsers, the generate image command and selection listener are not supported.

Features

  • Generate beautiful image of code and terminal
  • Copy or save image in PNG / JPG / WEBP format
  • Click line number to highlight lines in 3 styles
  • Click red circle on top left to clear all codes

Showcase

Code: code

Terminal: terminal

Limitation

  • No effect about editor.bracketPairColorization
  • "pollute" your clipboard
  • Snap on terminal cannot be updated if selection in terminal changed

Configurations

KeyDescriptionTypeDefault
codeimg.backgroundThe CSS background of the snippet's container. If you don't want to it, set it nonestring"linear-gradient(345deg, rgb(180 218 255) 0%, rgb(232 209 255) 100%)"
codeimg.boxShadowThe CSS box-shadow for the snippet's container. If you don't want to it, set it nonestring"medium"
codeimg.containerPaddingThe CSS padding for the snippet's container. If you don't want to it, set it nonestring"3rem"
codeimg.borderBorder for the snippet's container. Only in dark themebooleantrue
codeimg.debounceWhether to update the code snippet with debounce when selection changesbooleantrue
codeimg.roundedCornersThe CSS rounded corners for the snippet's container. If you don't want to it, set it nonestring"1rem"
codeimg.scaleThe scale of the screenshotnumber2
codeimg.formatThe format of the screenshotstring"png"
codeimg.terminalLineHeightLine height of terminal when generating terminal imagenumber1.3
codeimg.showWindowControlsDisplay OS X style window controlsbooleantrue
codeimg.windowControlsColorAdd color in window controlsbooleantrue
codeimg.showWindowTitleDisplay window title with open folder / file namebooleantrue
codeimg.showLineNumbersDisplay line numbersbooleantrue
codeimg.realLineNumberThe line number begins with the actual line number instead of starting at 1booleanfalse
codeimg.wrapLineWrap long lines to fit the container widthbooleanfalse
codeimg.trimPrefixWhitespacesTrim the prefix whitespaces in every line and keep indent. Also trim empty lines aroundbooleantrue

Commands

CommandTitle
codeimg.openCodeImg: open preview panel
codeimg.generate.codeCodeImg: generate image for code ๐Ÿ“ท
codeimg.generate.terminalCodeImg: generate image for terminal ๐Ÿ› ๏ธ

credit