- Notifications
You must be signed in to change notification settings - Fork93
Create beautiful image of your source code.
License
Aloxaf/silicon
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Silicon is an alternative toCarbon implemented in Rust.
It can render your source code into a beautiful image.
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 iscarbon-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 whilecarbon-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 usingHomebrew:
brew install silicon
sudo apt install expatsudo apt install libxml2-devsudo apt install pkg-config libasound2-dev libssl-dev cmake libfreetype6-dev libexpat1-dev libxcb-composite0-dev libharfbuzz-dev libfontconfig1-dev g++
sudo dnf install \ cmake \ expat-devel fontconfig-devel libxcb-devel \ freetype-devel libxml2-devel \ harfbuzz
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'<<EOFecho Helloecho 你好echo ∠( ᐛ 」∠)_EOF
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"
seesilicon --help
for detail
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 replacebat cache --build
tosilicon --build-cache
.
You can write some common args tosilicon --config-file
.
Example:
# enable shadow--shadow-color'#555'--background'#fff'--shadow-blur-radius 30--no-window-controls
About
Create beautiful image of your source code.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.