Code Monkey home page Code Monkey logo

carbon's Introduction

maintained with Ranger All Contributors MIT License FOSSA Status



Translations
Español हिंदी Deutsch 简体中文 Português
മലയാളം Türkçe 한국어 தமிழ் Français
日本語 Svenska Polski Nederlands 正體中文
Indonesia Українська Italiano עברית Русский
العربية বাংলা Add +

Introduction

You know all of those code screenshots you see on Twitter? Though the code's usually impressive, we saw room for improvement in the aesthetic department. Carbon makes it easy to create and share beautiful images of your source code. So what are you waiting for? Go impress all of your followers with your newfound design prowess.

Carbon example

Features

  • Customization. Customize things like your image's syntax theme, font style, and more
  • Share quickly. Save your image or a link with one click
  • Save snippets. Create an account to save snippets for later. Shared snippets are automatically unfurled on Twitter and Slack.

Usage

Import

There are a few different ways to import code into Carbon:

Customization

Once you've got all of your code into Carbon, you can customize your image by changing the syntax theme, background color, window theme, padding, shadows, fonts, and more.

Exporting & Sharing

After you've customized your image you can share your snippet in a number of ways

Create a saved snippet

Sharing a saved snippet will automatically unfurl the image on platforms like Twitter and Slack. This lets users see your creation, while also giving them access to the source code via the link. Better yet, if you need to make an update, simply follow the link yourself to edit the snippet directly.

To create a saved snippet:

  1. Login using the "Sign in/Sign up" button
  2. Edit as you normally would — your snippet will get saved automatically
  3. Copy the URL from your browser window and share away!
Embed a snippet

This is the recommended method for sharing Carbon on your own website or blog. Readers can even copy the code with the click of a button.

You can embed any Carbon snippet in your website directly using the carbon.now.sh/embed URL. The "Copy Menu" lets you quickly copy the correct iFrame snippet, or the encoded URL for embedding on platforms like Medium.

Finally, you can also embed saved snippets or GitHub gists using carbon.now.sh/embed/:id.

Use the Tweet button

The Tweet button will not only share the image on Twitter, but it will also correctly encode the alt text to ensure your images are accessible. However, if you want to tweet image yourself, please check out how to make your Twitter images accessible.

Download the image directly

Carbon supports downloading your image as a PNG and SVG. You can also click Export → Open to open your image directly in the browser. Finally, you can copy the Carbon image directly to your clipboard by going to Copy → Image.

Installing Carbon for Desktop (Offline)

If you are using Google Chrome, or another browser that supports Progressive Web Apps, you can install Carbon for use offline by:

  1. Visit carbon.now.sh
  2. Click your browser's settings menu
  3. Click "Install Carbon..."

Community

Check out these projects our awesome community has created:

Editor Plugins
Tools
  • CLI carbon-now-cli - Open a file in Carbon or download it directly using carbon-now, featuring an interactive mode, selective highlighting and more
  • CodeExpander - A smart GitHub gist client with the TextExpander features
  • nef - Export multiple Carbon code snippets from Xcode Playground.
  • @carbonshbot - A Telegram chatbot which takes in a code snippet or gist URL and generates an Carbon image
  • R carbonate - Iteratively manipulate image aesthetics in R and either open in Carbon or download directly.
  • Carbon for Slack - Use Carbon directly in Slack. Just invoke the /carbon command.
Citations

Authors

Carbon is a project by:

License

FOSSA Status




Contribute & Support

Pull requests are welcome! Please see our contributing guidelines for more details.

Sponsors & Backers

Fossa

Powered by Vercel

Thanks To

▲ Vercel for sponsoring Carbon's hosting.

All Contributors

Thanks goes out to all these wonderful people (emoji key):


briandennis

💻 📖 🚇 👀

mfix22

💬 💻 🤔

jakedex

💬 💻 🎨 📹

andrewda

💬 💻 🐛 👀

yeskunall

💻 📖 🔧 🐛

stoshfabricius

💻

jkling38

📖

otobrglez

💻

darahak

📖

dom96

💻

elrumordelaluz

💻

cjb

💻

Krzysztof-Cieslak

💻

fernahh

📖

g3r4n

💻

Mat Gadd

🐛 💻

Brad Davies

🐛 💻

Rafael Câmara

💻

Gleb Bahmutov

⚠️ 🔧

Iván Munguía

💻

Dillon Mulroy

💻

Nihad Abbasov

💻

Bruno C. Couto

💻

Mark Molnar

💻

Takahiko Inayama

💻

François Martin

💻

Raphael Amorim

💻

Camron Flanders

💻

Eric Adamski

💻

Winner Crespo

💻 🎨

Milos

💻 🔧 📖 🌍

Yashu Mittal

💻

Rachel M. Carmena

📖

Miguel Salazar

📖 🌍

Vyom Jain

📖 🌍

racaljk

🌍

Sean

💻

Izabela Borges

🌍

Shinil M S

🌍

Berke Atac

🌍

LEE YONGJUN

🌍

Matthew Nielsen

💻

Boy

📦

Vetrivel Chinnasamy

🌍

Farzad YZ

💻 🤔

Yannick Loriot

🌍

Joel Hanson

💻

Muhammad Muzzammil

💻

souppower

🚇

Masato Urai (@uraway_)

🌍

Fernando

🌍

Megha Sachdev

💻 ⚠️

Anudeep Reddy

🚇

Munieru

🌍

Adam Lusted

💻

Jose Noriega

🌍

Merlin Fuchs

🌍

Ramy Majouji

💻

Viktor Nemes

💻

Eric Bailey

💻

Nazeefa

🌍

Pratik Butani

📝

Bakti Aditya

💻

Caleb Taylor

💻

Rogério Munhoz

💻

Technoknol

💻

Tymoteusz Makowski

💻

Nisar Hassan Naqvi

🐛

Ilyas Karim

🐛

Nick Fix

🤔

Melanie Sumner

🤔

aluc

💻

B. Mearns

🤔

Peng Jie

💻

Binyamin Aron Green

💻

Michal

🌍

Quinn Blenkinsop

💻

Dwiferdio Seagal Putra

💻

Ashley Woodall Clark

💻

Tim Wienk

🌍

George McCarron

📖

Erwin Rahayu

🌍 📖

Luca

💻

Andrew Hayes

💻

Bereket Semagn

💻

Lorenzo Lancia

🌍

Guy Adler

🌍

Dan Bamikiya

🤔

kewang

🌍

Rizda Dwi Prasetya

🖋

AbreuY

🌍

>_Rizky.dev

🌍 📖

Abidemi Harry

💻

Marco

🌍

Sam Robbins

📖

alceil

💻

hatsu

💻

Praveen Kumar Purushothaman

🌍

Amir Elsagan

🌍

korzck

🌍

Sakibul Alam

🌍

carbon's People

Contributors

adghayes avatar allcontributors[bot] avatar andrewda avatar aquaductape avatar aymanesarrar avatar boyvanamstel avatar briandennis avatar crimsontome avatar dependabot[bot] avatar drarok avatar fernahh avatar g3r4n avatar greenkeeper[bot] avatar hatsu38 avatar hzooly avatar imbrn avatar jakedex avatar josenoriegaa avatar kant avatar martinfrancois avatar mfix22 avatar mittalyashu avatar mixn avatar molnarmark avatar muhammadmuzzammil1998 avatar rizkytegar avatar timneutkens avatar uraway avatar y1yang0 avatar yeskunall avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

carbon's Issues

Solarized theme has inaccurate colors

This is what code looks like on https://carbon.now.sh/ when I choose the Solarized theme:

lib/constants.js code displayed in Carbon's Solarized theme

But the background color is different from that of the light variant of the official Solarized theme:

official Solarized theme, light version

The background looks white in Carbon, but it should be light yellow. I'm not sure, but the shade of orange used for export const might also not be in Solarized's palette.

Note that Solarized also has a dark theme with the same text colors but a dark blue background. Don't get them confused. Maybe you want to support both as "Solarized (light)" and "Solarized (dark)"?

Feature request: Copy Image to clipboard

It will be really great if there is copy to clipboard option.
Quite helpful when you have to share the image to slack - discord or any other chatting application which supports direct upload.

Feature request: Customizable dimensions

First of all, great idea!

I'd like to share some code on Instagram, but it requires me to share only square images.

A greate feature would be the ability to set/change dimensions of the image.

Cheers!

Use `.github` for GitHub templates

Maybe create a .github/ folder at this point, and move CONTRIBUTING.md inside it? Also, maybe create an ISSUE_TEMPLATE.md and PULL_REQUEST.md?

But most importantly, in lieu of #79, I was thinking that maybe we can add a CONTRIBUTORS.md inside .github/ and link it in README.md instead? This way the README itself doesn't have to get cluttered unnecessarily.

Fix `` highlighting for F#

There is an issue with how textual functions names are displayed for F#, please, take a look:

carbon 1

It would be great if words in function name could be colored using the same color.

Carbon CLI

If there's enough support, we could create a CLI interface for Carbon.

Safari 11: Save Image

Saving as image doesn't work.

[Error] TypeError: e.replace is not a function. (In 'e.replace(/&/g,"&")', 'e.replace' is undefined)
	t (app.js:21:977311)
	p (app.js:21:982629)
	value (app.js:21:616414)
	value
	value (app.js:21:616248)
	value
	(anonymous function) (app.js:21:1529383)
	bt (app.js:2:23963)
	vt (app.js:2:24238)
	ar (app.js:2:50646)
	pr (app.js:2:53169)
	Za (app.js:2:98526)
	(anonymous function) (app.js:2:147167)
[Error] Unhandled Promise Rejection: [object Event]
	(anonymous function)
	promiseReactionJob

Adjust width

I just generated this image:

carbon-1

It'd be great if:

  • I could make the font size bigger (ref #46)
  • but also if I could shrink the width of the code block manually (or it adjust automatically based on longest line)

Screenshot shows text highlighting

If you have some text highlighted on the code snippet it preserves that highlighting when the image is generated.

Not sure if this is desired or not. I unexpectedly generated an image with the highlight when I didn't want it.

Thanks for an awesome resource!

Add C# Support

C# is not on the list, either it's not supported or doesn't work properly.

Make `carbon.now.sh` a PWA

This is something that can start out slow, but if you guys seem interested, I think, IMO, turning carbon.now.sh into a PWA would be super 👍

The most important think would be to allow caching, and hence enable the site to work offline as well. What do you guys think?

Loving this app so far 😍

Force `Save As` dialog when trying to save the image

Hey guys 👋 great work on Carbon!

Right now, all images are saved as carbon.png by default. This means that if I were to save multiple screenshots in succession, they would all be saved under the same name, with just a number appended to the file name (on Windows as carbon (1).png) and so on.

Maybe we could make it so that the site forces a Save As dialog asking the user to name the file by themselves? Just a suggestion, but I would love to see this implemented. ❤️

Read content & preferences from URL query string

This would make sharing links to the page much easier.

For example, https://carbon.now.sh/?code=Hello%20world!&theme=blackboard would pre-fill the editor with "Hello world!" and apply the Blackboard theme. Everything else would fall back to the default settings, of course.

If this would be a welcome addition, I'll open a PR for it.

Add C# language support

It would be really great if this service could support syntax highlighting for C# programming language.

Thanks!

Box shadow size

Hello!

Thank you guys for this useful tool!
I would suggest to add an option to set the size of the box shadow.
(I will try to find the time to create the PR)

Option to download/copy code from image

Hey guys!

I really love the idea of the code sharing by image and how it get presented. I only found a limitation whenever I want to share my code to be copied by a reader. You guys think this is possible in a future stage?

Wished feature;
Possibility to copy the code shown on the image to an editor.

Missing Mobile Support

Your website is broken when used on a mobile device. By broken I am referring to the issue that when your website is viewed on a screen less than 893px wide, your website does not allow horizontal scrolling to view parts of the screen that become hidden. A simple way to fix this would be to just allow horizontal scrolling. Another fix would be to use @media queries to adjust for screens smaller than 893px and then again for even smaller screens. And yet another idea would be to use percentages % or viewport width vw

carbon now sh-

It is a nice tool, but it doesn't work in Safari

I tried to use Carbon in Safari, but it doesn't work.

I copied and paste some code to the window, but when I press the Save Image button, nothing happen.

When I tried in Chrome, worked fine!

Add Windows theme

I know many devs don't think of Windows but it would be nice to have Windows represented here rather than the assumption that the UI will be OSX.

C code not highlighted as expected

C or C++ code is not highlighted as I would expect.
I saw that you were using CodeMirror, so I went to see the documentation.

It should at least highlight type names, as seen on this page.
See what I got on Carbon below, with Monokai theme.

I only looked at lib/constants.js and components/Carbon.js and didn't see anything wrong, so I'm not sure what's happening. Maybe a style conflict?

Sample

carbon

Light themes support

Right now there are not light terminal themes. Some users may want to use white (or similar) terminal background.

I am big fan of light terminal themes like sobole.

Any chance to get a tool to import a custom theme?
Or maybe include some popular light options?

Support Color Picker

Could be awesome be possible open a color picker for setup the background.

This also be possible setup transparent as brakcgorund.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.