Go to file
Aloxaf 57c85c0dae Fix 2019-08-10 13:26:30 +08:00
assets Keep the empty directory 2019-07-13 13:23:33 +08:00
ci Update CI 2019-08-09 17:54:12 +08:00
src Fix 2019-08-10 13:26:30 +08:00
.gitignore Keep the empty directory 2019-07-13 13:23:33 +08:00
.travis.yml Update CI 2019-08-09 18:30:00 +08:00
Cargo.lock Improve support for Windows clipboard 2019-08-10 00:09:32 +08:00
Cargo.toml Improve support for Windows clipboard 2019-08-10 00:09:32 +08:00
LICENSE Initial commit 2019-07-10 13:59:49 +08:00
README.md Update CI 2019-08-09 17:54:12 +08:00
appveyor.yml Update CI 2019-08-09 18:30:00 +08:00

README.md

Silicon

Crates.io Documentation 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

# or the latest version (Linux/macOS)

cargo install --git https://github.com/Aloxaf/silicon

# for Windows (see #11)

git clone --single-branch --branch dev https://github.com/Aloxaf/silicon
cd silicon
cargo build --release

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