> HackerTyper Blog

How to Create Visually Appealing Code for Twitter

If you spend time on Twitter, especially in dev circles like #100DaysOfCode and #CodeNewbie, you have probably noticed pictures of code like this:

Example Code

How do you make one of these images?

Let's dive into three different possibilities:

Carbon

Carbon

Link: carbon.now.sh

Carbon is probably the most common way of creating code snippets. It is highly customizable and easy-to-use.

The main use-case for Carbon is to take a snippet of code, paste it as text and make it look nice by choosing the style.

It should automatically detect what language you want to use, but you can also manually select a large variety of languages.

What are the features of Carbon?

  • Many export options, including directly posting to Twitter
  • Line numbers
  • Prettify code

Graphite-Shot

Graphite-Shot

Link: graphite-shot.now.sh

Shameless plug here since I am the creator of this one: Graphite-Shot solves a similar issue as Carbon, but instead of pasting your code in a text format, you use screenshots.

Carbon is great–however, you might need extra features in your image that you can't transport from your editor. For example, error checking or particular code highlighting.

Why use Graphite-Shot?

Graphite Shot offers these special features:

  • Paste images from the clipboard
  • Support for multiple windows of code
  • Automatically detect background color
  • Adjust shadow and background color

Polacode

Polacode

Link: VSCode Marketplace

Polacode is similar to Carbon in that it allows you to copy code in a text format; in contrast, it's integrated directly into VSCode. This means there is no need to open any extra websites.

Your images are directly saved to your machine and then easily shared.

Unfortunately, it's not as feature-rich as Carbon, but it's definitely worth the convenience if you want to quickly deliver the code.

What are the features of Polacode?

  • Works directly in the IDE
  • Resizable window

Conclusion

All three tools are very similar, yet they each solve the same problem from a different perspective. Rather than choosing which one is best, it's important to realize they all complement each other.

Oh and did I mention? They are all open source!

Which one will you try out next?