Created
June 29, 2013 18:56
-
-
Save crlane/5892235 to your computer and use it in GitHub Desktop.
I wrote this to generate a bunch of colorscheme previews from the highlight script at [here](http://www.andre-simon.de/doku/highlight/en/highlight.html)
. YMMV.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import os, sys | |
from subprocess import call | |
_THEMES = '/usr/local/Cellar/highlight/3.12/share/highlight/themes/' | |
_CMD = 'highlight {} --output={} -O {} --line-numbers --font-size {} --font {} --style {} -W -J {} -j {}' | |
_OUTPUT = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'output/') | |
_TEST =os.path.join(os.path.dirname(os.path.realpath(__file__)), 'test/') | |
_JAVA = 'Picture.java' | |
#_PYTHON = 'picture.py' No python test file yet | |
def highlight(src_file=None, output=None, fmt='rtf', size=24, font='Courier', style='anotherdark', wrap=55, linenumpad=3, *args, **kwargs): | |
"""docstring for highlight""" | |
if not output: | |
output = os.path.join(_OUTPUT, '.'.join([os.path.basename(src_file),style,fmt])) | |
if os.path.isdir(output): | |
os.makedirs(output) | |
command = [str(c) for c in _CMD.format(src_file,output,fmt,size,font,style,wrap,linenumpad).split()] | |
call(command) | |
if __name__ == '__main__': | |
themes = os.listdir(_THEMES) | |
colors = [] | |
for theme in themes: | |
colors.append(theme.split('.')[0]) | |
for c in colors: | |
highlight(src_file=os.path.join(_TEST,_JAVA), style=c) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment