Vim can do this
1. Open your script/code in vim editor
2. Enable syntax & set the required color scheme
:syntax on :colorscheme darkblue
3. Print the file in PS file format
:hardcopy >/tmp/filename.ps
4. Convert the PS file to PDF format
$ ps2pdf /tmp/filename.ps
5. Now you can open filename.pdf