There are many libraries that provide this. you can use prettify.js from Google developers,highlight.js (http://highlightjs.org/), or any others you can find on the internet.
this time i'd like to give you some screenshots of highlight.js themes.
These are my favorite themes and i use one of them for this site. you can see how it works here : [Tutorial] Dynamic Layout in Laravel 4 for example (github theme)
Ok here are the lists :
1. github theme ( github.css)
2. Foundation (founfation.css)
3. Googlecode (googlecode.css)
4. Obsidian (obsidian.css)