🚨 Important Notice: Dropped, find out this awesome cli that has exactly what i was trying to build silicon! 🚨
A CLI tool for generating beautiful, customizable code snippet images - right from your terminal. Inspired by carbon.now.sh, Carbonrs lets you create stunning visuals of your code with syntax highlighting, customizable fonts, themes, sizes, and more.
Carbonrs is written in Rust and leverages powerful libraries:
syntect
: For syntax highlightingimage
/imageproc
: For drawingab_glyph
: For font rendering
The goal is to provide a fast, lightweight, and fully customizable CLI experience that replicates and extends the functionality of carbon.now.sh.
- Command-Line Interface: Generate images directly from your terminal.
- Syntax Highlighting: Uses
syntect
for accurate and beautiful code highlighting. - Customizable Appearance:
- Change fonts (with support for custom fonts).
- Switch between themes.
- Adjust font sizes and image dimensions.
- Simulated Window Controls: Optionally render macOS-style window buttons (red, yellow, green).
- Fast & Lightweight: Built in Rust for optimal performance.
- Ensure you have Rust installed.
cargo install --git https://github.com/dantescur/carbonrs
git clone https://github.com/dantescur/carbonrs.git
cd carbonrs
cargo build --release
The compiled binary will be available in the target/release
directory.
Carbonrs is designed to be simple and straightforward. At its core, it converts a source code file into an image with highlighted syntax.
carbonrs path/to/your/code_file --output path/to/output_image.png
If you do not specify an output file, it defaults to output.png
.
To generate an image from src/main.rs
and save it as my_code.png
:
carbonrs src/main.rs --output my_code.png
Carbonrs aims to offer extensive customization options, both now and in future releases:
- Current: Embedded Fira Code Nerd Font Mono.
- Planned: Support for custom fonts.
- Default:
base16-ocean.dark
. - Planned: Additional built-in themes and support for user-defined themes.
- Customize font size, line height, and image dimensions.
- Optional macOS-style window controls (red, yellow, green buttons).
- Planned customization options for these controls.
Note: Many of these options will be made available through CLI flags or a configuration file in upcoming releases.
- Basic CLI functionality for generating code snippet images.
- Support for dynamic font selection.
- Additional themes and support for user-defined themes.
- Enhanced customization for background colors, window controls, and overall layout.
- Better handling of diverse file types and languages.
- Integration with configuration files for persistent settings.
Contributions are very welcome! If you have suggestions, bug reports, or would like to add new features, please:
- Fork the repository.
- Create a feature branch.
- Submit a pull request.
For major changes, please open an issue first to discuss your ideas.
Carbonrs is licensed under the MIT License. See the LICENSE file for details.
- carbon.now.sh for the inspiration.
- The Rust community and the developers of the libraries used in this project.
- Fira Code font authors for the embedded font.
Happy coding! 🦀 Create stunning code visuals with Carbonrs!