Linux command
silicon 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Generate code image from file
silicon [source.rs] -o [code.png]
Generate from clipboard
silicon --from-clipboard -o [code.png]
Specify language
silicon --language [python] -o [code.png] < [code.py]
Use specific theme
silicon --theme [Dracula] [source.rs] -o [code.png]
Add line numbers
silicon --line-number [source.rs] -o [code.png]
Custom background color
silicon --background ["#1e1e2e"] [source.rs] -o [code.png]
Add shadow
silicon --shadow-blur-radius [10] [source.rs] -o [code.png]
List available themes
silicon --list-themes
说明
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.
参数
- -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.
FAQ
What is the silicon command used for?
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.
How do I run a basic silicon example?
Run `silicon [source.rs] -o [code.png]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -o _FILE_, --output _FILE_ do in silicon?
Output image file.