How to highlight code for presentations

If you’re putting together a presentation on a Mac in Keynote or PowerPoint and need to code look pretty with syntax highlighting for your slides, you’re just a few commands away.

First you’ll need to install highlight.

$ brew install highlight

Then run the following command.

$ pbpaste | highlight -S ruby -O rtf -s dusk | pbcopy

Now paste the contents of the code into your presentation and violĂ !

There are several themes to choose from if you don’t fancy the dusk theme.

$ highlight -w
acid
aiseered
andes
anotherdark
autumn
baycomb
bclear
biogoo
bipolar
blacknblue
bluegreen
breeze
bright
camo
candy
clarity
dante
darkblue
darkbone
darkness
darkslategray
darkspectrum
denim
dusk
earendel
easter
edit-anjuta
edit-eclipse
edit-emacs
edit-flashdevelop
edit-gedit
edit-jedit
edit-kwrite
edit-matlab
edit-msvs2008
edit-nedit
edit-vim-dark
edit-vim
edit-xcode
ekvoli
fine_blue
freya
fruit
golden
greenlcd
kellys
leo
lucretia
manxome
maroloccio
matrix
moe
molokai
moria
navajo-night
navy
neon
night
nightshimmer
nuvola
olive
orion
oxygenated
pablo
peaksea
print
rand01
rdark
relaxedgreen
rootwater
seashell
solarized-dark
solarized-light
tabula
tcsoft
vampire
whitengrey
xoria256
zellner
zenburn
zmrok

Now get out there and present some code!