Highlight line in ImageFormatter

Issue #457 resolved
Jonas Obrist
created an issue

I propose adding a line-highlighting option to the ImageFormatter. Add two options to the formatter: hl_background_color and hl_line_number.

Unfortunately I'm not really good with PIL so I don't have a patch for this.

Comments (3)

  1. Jonas Obrist reporter

    Added a diff for img.py as well as an example output for following code:

    from img_new2 import ImageFormatter
    from pygments import highlight
    from pygments.lexers import PythonLexer
    from StringIO import StringIO
    from PIL import Image
    f = ImageFormatter(hl_line_number=2, font_name='FreeMono', highlight_color='#fc6')
    l = PythonLexer()
    c = """def say_hello(name):
        print 'hello %s' % name
    d = highlight(c,l,f)
    sio = StringIO(d)
    im = Image.open(sio)
  2. Log in to comment