silicon

Create beautiful image of your source code.

Github星跟踪图

Silicon

Crates.io
Documentation
CI
Linux Build Status
Windows build status
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 problem.
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.

Disadvantages

It's not as beautiful as Carbon...

Install

Cargo

cargo install silicon

AUR

Silicon is available on AUR (Thanks to @radmen).

You can install it with any AUR helpers you like.

eg.

pikaur -S silicon

Dependencies

Arch Linux

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

Examples

Read code from file

silicon main.rs -o main.png 

Read code from clipboard, and copy the result image to clipboard(--to-clipboard is only available on Linux)

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

Use multiple fonts

silicon main.rs -o main.png -f 'Hack; SimSun'

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'

see silicon --help for detail

主要指标

概览
名称与所有者Aloxaf/silicon
主编程语言Rust
编程语言Rust (语言数: 2)
平台
许可证MIT License
所有者活动
创建于2019-07-07 14:50:55
推送于2024-09-26 01:08:27
最后一次提交2024-09-26 09:02:16
发布数15
最新版本名称v0.5.3 (发布于 )
第一版名称v0.2.6 (发布于 )
用户参与
星数3.3k
关注者数13
派生数87
提交数241
已启用问题?
问题数92
打开的问题数34
拉请求数96
打开的拉请求数13
关闭的拉请求数71
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?