Light Up Your Code: Ultraviolet

I like the look of the output from the funky Ultraviolet syntax highlighting engine for code snippets in blogs, so I figured it was about time that I actually used it.
My blogging software of choice, Webby, comes with an Ultraviolet helper, consequently, I was feeling confident that I would be entering highlighting heaven without a struggle. I read the Webby reference material and saw that CSS files for the Ultraviolet themes (colour schemes) were required. Problem was that I didn’t see any mention of where these vital artefacts might be obtained.
Luckily, my good mate Google was able to supply a useful post from Yak Shavings (much obliged to you Phil Barnes) that allowed me to produce the CSS files for the standard Ultraviolet themes. After installing the gem with sudo gem install ultraviolet, I fired up irb and did the following -
irb(main):001:0> require 'uv' => true irb(main):002:0> Uv.copy_files "xhtml", "css" => ["/opt/local/lib/ruby/gems/1.8/gems/ultraviolet-0.10.2/lib/.."]
Voila, a directory named ‘css’ containing the theme files appeared in my own ‘css’ directory that I had specified in the call to Uv.copy_files above. Magnifique.
I subsequently found that Ultraviolet has a command line utility after looking at the ‘usage’ page of the web site. If you type uv —help at the terminal/console you will get a helpful list of commands. I used this one to achieve a similar result to my irb excursion above -
uv -s ruby --copy-files css
This command did not return of its own volition and required a Ctrl-C to terminate it on my system. Has anyone else experienced this? Nonetheless, the CSS files were generated correctly when I examined them.
Here’s a small example of Ultraviolet’s prowess -
sunburst theme
1 # Find the missing Ultraviolet CSS files 2 def google_search(string) 3 answer = Google(string) 4 puts answer 5 end
Ain’t it a thing of beauty?

