[IPython-User] Custom color stylesheets for iPython qtconsole

Jason Wirth wirth.jason@gmail....
Wed Oct 19 02:43:52 CDT 2011


I installed 0.12. The styles now work! Thank you.

I played around and figured out how to create a custom style; see the
instructions below.
Happy theming iPython! :)

Styles are a .py file stored in: site-packages/pygments/styles/

The element you want to color is called a "token".
See the list of available tokens: http://pygments.org/docs/tokens/
Make sure to include all the tokens in a line:
from pygments.token import <your tokens>

The name of the style class is particular. Use the same name as your file
name, first letter capitalized + "Style"
Example:
- darkblue.py, class DarkblueStyle(Style)

CAUTION!
I don't think all file names work. Using underscores gave me problems. I
don't know what else may be prohibited.
This doesn't work: dark_blue.py, class Dark_blueStyle(Style)





Example:
Create a mycolors.py file in: site-packages/pygments/styles/
----------------------------------------------------------------------
from pygments.style import Style
from pygments.token import Text, Number

class MycolorsStyle(Style):

    background_color = '#000'
    highlight_color = '#ffff55'

    styles = {

        Text: "#A7ADDB",
        Number.Float: "#2200FF",
        Number.Integer: "#E5FF00"
    }

----------------------------------------------------------------------

Run the style with this line:
ipython qtconsole --style=mycolors
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20111019/0e6c68d1/attachment.html 


More information about the IPython-User mailing list