Jekyll syntax highlighting themes

Jekyll uses rouge for syntax highlighting. Despite huge popularity of Jekyll among programmers, it took me a while to find some really beautiful code highlighting themes. All you need is just a syntax.css with some nice colors for the code, but it turned out to be not so easy to find.

Eventually, I stumbled upon the base16 color schemes. On the preview website you can see how they look like. The themes as they are packaged cannot be directly consumed by rouge. Fortunately though, there is a repo on GitHub with base16 styles for pygments. Since rouge recognizes pygments themes, you may just grab a stylesheet of your liking, rename it to syntax.css, replace CSS class .syntax with .highlight, and you are done.

Here is an example of a slightly tweaked Railcasts theme

require "rubygems"

string = "tomorrow"
symbol = :tomorrow
fixnum = 0
float  = 0.00
array  = Array.new
array  = ['chris', 85]
dict   = {"test" => "test"}
regexp = /[abc]/

# This is a comment
class Person

  attr_accessor :name

  def initialize(attributes = {})
    @name = attributes[:name]
  end

  def self.greet
    "hello"
  end
end

person1 = Person.new(:name => "Chris")
print Person::greet, " ", person1.name, "\n"
puts "another #{Person::greet} #{person1.name}"