Skip to content
This repository was archived by the owner on Mar 18, 2025. It is now read-only.
/ carbonrs Public archive

🦀 Create stunning code visuals with Carbonrs!

Notifications You must be signed in to change notification settings

Dantescur/carbonrs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚨 Important Notice: Dropped, find out this awesome cli that has exactly what i was trying to build silicon! 🚨


Carbonrs 🖼️

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.


Overview

Carbonrs is written in Rust and leverages powerful libraries:

  • syntect: For syntax highlighting
  • image/imageproc: For drawing
  • ab_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.


Features

  • 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.

Installation

Prerequisites

  • Ensure you have Rust installed.

Install via Cargo

cargo install --git https://github.com/dantescur/carbonrs

Build from Source

git clone https://github.com/dantescur/carbonrs.git
cd carbonrs
cargo build --release

The compiled binary will be available in the target/release directory.


Usage

Carbonrs is designed to be simple and straightforward. At its core, it converts a source code file into an image with highlighted syntax.

Basic Command

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.

Example

To generate an image from src/main.rs and save it as my_code.png:

carbonrs src/main.rs --output my_code.png

Customization

Carbonrs aims to offer extensive customization options, both now and in future releases:

Fonts

  • Current: Embedded Fira Code Nerd Font Mono.
  • Planned: Support for custom fonts.

Themes

  • Default: base16-ocean.dark.
  • Planned: Additional built-in themes and support for user-defined themes.

Sizes & Layout

  • Customize font size, line height, and image dimensions.

Window Controls

  • 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.


Roadmap

  • 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.

Contributing

Contributions are very welcome! If you have suggestions, bug reports, or would like to add new features, please:

  1. Fork the repository.
  2. Create a feature branch.
  3. Submit a pull request.

For major changes, please open an issue first to discuss your ideas.


License

Carbonrs is licensed under the MIT License. See the LICENSE file for details.


Acknowledgments

  • 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!

About

🦀 Create stunning code visuals with Carbonrs!

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages