I know that there is
listings for displaying nice code in .tex documents. However, I'd like to use the style that is used for Stackoverflow code: example. Are there any packages for this, or do I need to create something customized?
stackexchange uses google prettify
to format code blocks.
It can't be too hard, if you format your code with that first to convert the generated html markup back to tex, but I don't know of an existing package that does it
Note Google has abandoned prettify and stackexchange now uses highlight.js