A beautiful code snippet generator inspired by Carbon. Create stunning images of your code snippets with customizable themes, backgrounds, and export options.
- Live Code Editor - Edit code in real-time with syntax highlighting
- Multiple Languages - Support for JavaScript, TypeScript, Python, Java, C, C++, Go, Rust, SQL, Bash, and more
- Theme Selection - Choose from various syntax highlighting themes
- Customizable Backgrounds - Transparent or custom background colors
- Window Controls - Optional macOS-style window decorations
- Adjustable Padding - Control the spacing around your code
- Dark/Light Mode - Toggle between dark and light interface modes
- Multiple Export Formats - Export as PNG, SVG, or copy directly to clipboard
- Responsive Design - Works seamlessly on desktop and mobile devices
- Framework: Next.js 16 with React 19
- Styling: Tailwind CSS v4
- UI Components: Radix UI
- Syntax Highlighting: Prism.js
- Image Export: html-to-image
- Notifications: Sonner
- Language: TypeScript
- Node.js 20+
- pnpm (recommended) or npm
- Clone the repository:
git clone https://github.com/yourusername/carbon-clone.git
cd carbon-clone- Install dependencies:
pnpm install- Run the development server:
pnpm dev- Open http://localhost:3000 in your browser
pnpm build
pnpm start- Edit Your Code: Type or paste your code into the editor
- Choose a Language: Select the programming language for proper syntax highlighting
- Customize Appearance:
- Pick a syntax theme
- Adjust padding
- Toggle window controls
- Set background color/transparency
- Switch between dark and light modes
- Export: Download as PNG/SVG or copy directly to clipboard
carbon-clone/
├── src/
│ ├── app/ # Next.js app router pages
│ ├── components/ # React components
│ │ ├── ui/ # Reusable UI components
│ │ ├── code-editor.tsx
│ │ ├── controls.tsx
│ │ └── preview-frame.tsx
│ ├── hooks/ # Custom React hooks
│ ├── lib/ # Utility functions
│ ├── styles/ # Global styles and themes
│ └── types/ # TypeScript type definitions
├── public/ # Static assets
└── package.json
- JavaScript
- TypeScript
- Python
- Java
- C
- C++
- Go
- Rust
- SQL
- Bash
- CSS
- JSON
Multiple syntax highlighting themes are available through Prism.js, providing options for different aesthetic preferences and readability needs.
This project is open source and available under the MIT License.
- Inspired by Carbon
- Built with modern web technologies and best practices
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the project
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
To run the project locally with hot reloading:
pnpm devTo check for linting issues:
pnpm lintMade with ❤️ using Next.js and TypeScript