Is there a way to get colored text in Github Flavored Markdown?

Roman A. Taycher picture Roman A. Taycher ยท May 28, 2014 ยท Viewed 171.6k times ยท Source

I need to document a library on github that output colored text in the terminal.

I've tried both span <style="color:red"> and <font color="red"> but it seems to strip out both tags.

Is the only way to do this is with images of colored text?

edit:

I ended up adding screenshots to git and using image links w/ github relative urls.

Answer

Brett Zamir picture Brett Zamir ยท Mar 29, 2016

In case this may be helpful for someone who just needs to show colors rather than output, as a hackish workaround (and FYI), since Github supports Unicode (as Unicode, numeric character references or HTML entities), you could try colored Unicode symbols, though it depends on the font rendering them in color (as it happens to be appearing for me on Windows 10 and Mac 10.12.5, at least, though on the Mac at least, the up/down-pointing small red triangles don't show in red):

  • RED APPLE (&#x1F34E;): ๐ŸŽ
  • GREEN APPLE (&#x1F34F;): ๐Ÿ
  • BLUE HEART (&#x1F499;): ๐Ÿ’™
  • GREEN HEART (&#x1F49A;): ๐Ÿ’š
  • YELLOW HEART (&#x1F49B;): ๐Ÿ’›
  • PURPLE HEART (&#x1F49C;): ๐Ÿ’œ
  • GREEN BOOK (&#x1F4D7;): ๐Ÿ“—
  • BLUE BOOK (&#x1F4D8;): ๐Ÿ“˜
  • ORANGE BOOK (&#x1F4D9;): ๐Ÿ“™
  • LARGE RED CIRCLE (&#x1F534;): ๐Ÿ”ด
  • LARGE BLUE CIRCLE (&#x1F535;): ๐Ÿ”ต
  • LARGE ORANGE DIAMOND (&#x1F536;): ๐Ÿ”ถ
  • LARGE BLUE DIAMOND (&#x1F537;): ๐Ÿ”ท
  • SMALL ORANGE DIAMOND (&#x1F538;): ๐Ÿ”ธ
  • SMALL BLUE DIAMOND (&#x1F539;): ๐Ÿ”น
  • UP-POINTING RED TRIANGLE (&#x1F53A;): ๐Ÿ”บ
  • DOWN-POINTING RED TRIANGLE (&#x1F53B;): ๐Ÿ”ป
  • UP-POINTING SMALL RED TRIANGLE (&#x1F53C;): ๐Ÿ”ผ
  • DOWN-POINTING SMALL RED TRIANGLE (&#x1F53D;): ๐Ÿ”ฝ