LinuxCommandLibrary

silicon

Generate beautiful source code images

TLDR

Generate code image from file

$ silicon [source.rs] -o [code.png]
copy
Generate from clipboard
$ silicon --from-clipboard -o [code.png]
copy
Specify language
$ silicon --language [python] -o [code.png] < [code.py]
copy
Use specific theme
$ silicon --theme [Dracula] [source.rs] -o [code.png]
copy
Add line numbers
$ silicon --line-number [source.rs] -o [code.png]
copy
Custom background color
$ silicon --background ["#1e1e2e"] [source.rs] -o [code.png]
copy
Add shadow
$ silicon --shadow-blur-radius [10] [source.rs] -o [code.png]
copy
List available themes
$ silicon --list-themes
copy

SYNOPSIS

silicon [--language lang] [--theme name] [--output file] [options] [file]

DESCRIPTION

silicon creates beautiful images of source code. It applies syntax highlighting, window chrome, and styling to produce images suitable for documentation, presentations, and social media.
Languages are auto-detected from file extension or specified explicitly. The tool uses syntect for highlighting, supporting most programming languages. Themes from popular editors (VS Code, Sublime) are included.
Output resembles a terminal or editor window. Window controls (traffic light buttons on macOS style) add realism. Shadows create depth. Rounded corners give a modern look.
Line numbers and line highlighting help explain specific code sections. Custom fonts ensure readable output with proper monospace alignment.
Clipboard integration enables quick workflows: copy code, run silicon, paste image. This streamlines creating code screenshots.
Padding, colors, and shadows are all customizable for matching brand guidelines or presentation themes.

PARAMETERS

-o FILE, --output FILE

Output image file.
-l LANG, --language LANG
Source language for highlighting.
--theme NAME
Color theme.
--list-themes
Show available themes.
--list-fonts
Show available fonts.
--from-clipboard
Read code from clipboard.
--to-clipboard
Write image to clipboard.
-f FONT, --font FONT
Font name.
--line-number
Show line numbers.
--line-offset NUM
Start line number.
--highlight-lines RANGE
Highlight specific lines.
--background COLOR
Background color.
--shadow-blur-radius PX
Shadow blur radius.
--shadow-offset-x PX
Shadow X offset.
--shadow-offset-y PX
Shadow Y offset.
--pad-horiz PX
Horizontal padding.
--pad-vert PX
Vertical padding.
--no-round-corner
Disable rounded corners.
--no-window-controls
Hide window buttons.

CAVEATS

Very long lines may produce wide images. Not all terminal themes available. Font must be installed for custom fonts. Large code blocks create large images. PNG output only (no SVG). Line highlight syntax can be tricky.

HISTORY

silicon was created by Aloxaf around 2019 as a Rust alternative to carbon-now-cli. Written in Rust, it provides offline code image generation. The name references silicon wafers and chips, alluding to code becoming "hardware." It's popular in developer communities for sharing code snippets.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community