17 releases

0.5.2 Nov 30, 2023
0.5.1 Oct 20, 2022
0.4.3 Jun 9, 2021
0.4.1 Mar 3, 2021
0.2.5 Jul 21, 2019

#401 in Command line utilities

Download history 82/week @ 2023-11-01 36/week @ 2023-11-08 46/week @ 2023-11-15 79/week @ 2023-11-22 187/week @ 2023-11-29 85/week @ 2023-12-06 74/week @ 2023-12-13 62/week @ 2023-12-20 67/week @ 2023-12-27 59/week @ 2024-01-03 37/week @ 2024-01-10 78/week @ 2024-01-17 68/week @ 2024-01-24 44/week @ 2024-01-31 39/week @ 2024-02-07 112/week @ 2024-02-14

278 downloads per month

MIT license



Crates.io Documentation CI License

Silicon is an alternative to Carbon implemented in Rust.

It can render your source code into a beautiful image.

Why Silicon

Carbon is a wonderful tool to create a beautiful image of your source code.

But it is a web application, which brings the following disadvantages:

  • Cannot work without Internet & browser.
  • Doesn't work well with shell. (Although there is carbon-now-cli, its experience is not very good, especially when the network is not so good.)

However, Silicon doesn't have these problems. It's is implemented in Rust and can work without browser & Internet.

Silicon can render your source code on the fly while carbon-now-cli takes several seconds on it.


It's not as beautiful as Carbon...



cargo install silicon

NOTE: harfbuzz feature is enabled by default. If you are using Windows, I suggest you disable it to get it build easier.


Silicon is available in the official repository:

pacman -S silicon


You can install Silicon using Homebrew:

brew install silicon



sudo apt install expat
sudo apt install libxml2-dev
sudo apt install pkg-config libasound2-dev libssl-dev cmake libfreetype6-dev libexpat1-dev libxcb-composite0-dev libharfbuzz-dev


sudo dnf install \
  cmake \
  expat-devel fontconfig-devel libxcb-devel \
  freetype-devel libxml2-devel \

Arch Linux

sudo pacman -S --needed pkgconf freetype2 fontconfig libxcb xclip harfbuzz


Read code from file

silicon main.rs -o main.png 

Read code from clipboard, and copy the result image to clipboard

silicon --from-clipboard -l rs --to-clipboard

Specify a fallback font list and their size

silicon -o main.png -l bash -f 'Hack; SimSun=31; code2000' <<EOF
echo Hello
echo 你好
echo ∠( ᐛ 」∠)_

Highlight specified line

silicon main.rs -o main.png --highlight-lines '1; 3-4'

Custom the image

silicon ./target/test.rs -o test.png \
    --shadow-color '#555' --background '#fff' \
    --shadow-blur-radius 30 --no-window-controls

Transparent background

The color can be #RGB[A] or #RRGGBB[AA]

silicon ./target/test.rs -o test.png --background '#fff0'

Show window title

silicon ./target/test.rs -o test.png --window-title "target/test.rs"

see silicon --help for detail

Adding new syntaxes / themes

Silicon reads syntax-definition and theme cache from user's cache directory.

The steps to add new syntaxes / themes is as same as bat: sharkdp/bat#adding-new-syntaxes--language-definitions. Just replace bat cache --build to silicon --build-cache.

Configuration file

You can write some common args to silicon --config-file.


# enable shadow
--shadow-color '#555'
--background '#fff'
--shadow-blur-radius 30

Related projects


~638K SLoC