The fastest C code syntax highlighter for the terminal, written in Rust.
A Rust implementation of the Aurora syntax highlighting engine, optimized for terminal output with beautiful colors using the One Dark Pro theme.
- 🚀 Blazing Fast: Written in Rust for maximum performance
- 🎨 Beautiful Highlighting: Uses the One Dark Pro theme for syntax highlighting
- ⚡ Lightweight: Minimal dependencies, fast execution
- 📝 Terminal Output: Direct syntax-highlighted output to your terminal
- 🎯 C Language Support: Full support for C syntax including preprocessor directives
- 🔧 Easy to Use: Simple command-line interface
- Rust 1.70 or higher
- Cargo (comes with Rust)
git clone https://github.com/codeAbinash/aurora-rust.git
cd aurora-rust
cargo build --releaseThe compiled binary will be available at target/release/aurora (or aurora.exe on Windows).
cargo install --path .aurora <filename>aurora test/test.cThis will read the C file and print it to the terminal with beautiful syntax highlighting.
# Display help message
aurora --help
aurora -h
# Display version
aurora --version
aurora -v
# Display about information
aurora --aboutAurora supports highlighting for:
- Comments: Single-line (
//) and multi-line (/* */) - Preprocessor Directives:
#include,#define,#ifdef, etc. - Keywords:
int,void,for,while,if,return, etc. - Functions: Function names and calls
- Strings: String literals with format specifiers
- Numbers: Decimal, hexadecimal (0x), octal (0), and binary (0b)
- Operators: Arithmetic, logical, and bitwise operators
- Escape Sequences:
\n,\t,\\, etc. - Brackets: Color-coded matching brackets
When you run Aurora on a C file, you'll see beautifully colored output in your terminal:
// Comments in gray
#include <stdio.h> // Preprocessor in violet, header files in green
int main() { // Keywords in violet, function names in blue
printf("Hello, World!\n"); // Strings in green, escape sequences highlighted
return 0; // Keywords and numbers highlighted
}aurora-rust/
├── src/
│ ├── main.rs # Entry point and CLI handling
│ ├── lib.rs # Library exports
│ ├── commands.rs # Command-line argument handling
│ ├── highlighter.rs # Syntax highlighting logic
│ ├── tokenizer.rs # Tokenization engine
│ ├── info.rs # Version and project info
│ └── lib/
│ ├── comments.rs # Comment parsing
│ ├── preprocessor.rs # Preprocessor directive parsing
│ ├── string.rs # String literal parsing
│ ├── escape.rs # Escape sequence handling
│ ├── number.rs # Number literal parsing
│ └── name_or_keyword.rs # Identifier and keyword parsing
├── test/
│ └── test.c # Test C file
├── Cargo.toml # Rust dependencies
└── README.md
Aurora uses the One Dark Pro theme with the following color scheme:
- Comments: Gray
#5c6370 - Keywords: Violet
#c678dd - Strings: Green
#98c379 - Numbers: Orange
#d19a66 - Functions: Blue
#61afef - Escape Sequences: Blue-Green
#56b6c2 - Operators: Violet
#c678dd
- colored - Terminal color library
Aurora is designed for speed and efficiency:
- Fast tokenization engine
- Minimal allocations
- Direct terminal output
- Zero-copy string slicing where possible
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
# Run in development mode
cargo run -- test/test.c
# Run tests
cargo test
# Format code
cargo fmt
# Run clippy for linting
cargo clippyThis project is licensed under the MIT License - see the LICENSE file for details.
Abinash Karmakar (@codeAbinash)
- aurora - The original C highlighting engine for the web
- aurora-react - React wrapper for Aurora
This project is a Rust implementation inspired by the original Aurora project, bringing the same beautiful syntax highlighting to the terminal.
Made with ❤️ and Rust 🦀