Code examples' color coding no longer make my eyes hurt

Written by Davy Hellemans -

The website used to use the highlight_string function from PHP. That works in most cases, but the color coding choices are very limited and need to be set using ini settings (or ini_set for that matter).

I came across highlight.js and so far it seems pretty reliable. They support quite a few programming languages and colors with their script. And the best part is that the compressed file you download will only contain those languages you want to highlight, which keeps the script fast.

Thanks to the new highlighting I managed to apply another color scheme (thx to Dave Lens for his phpzen theme). Check out the example below.

// This is a single-line comment
$stringvariable = "examplestring";
$intvariable = 300;

/**
 * The description of my test class
 *
 * @author Davy Hellemans <davy@spoon-library.com>
 */
class Testclass
{
	public function test($param = 'default')
	{
		return true;
	}
}