What is Jupiter default color theme for code highlighting?

1,180 views
Skip to first unread message

Gandalf Saxe

unread,
Dec 29, 2016, 11:45:41 AM12/29/16
to Project Jupyter
What is the default color theme for Python in Jupiter called?
I wish to make my code in LaTeX using "minted" the same color theme as in Jupiter.

Thanks.

Mike Pacer

unread,
Dec 29, 2016, 1:50:22 PM12/29/16
to jup...@googlegroups.com
Because it's not a default theme, I think this will take a bit of custom work, but nothing too crazy.

The first thing to note is that jupyter uses codemirror for syntax highlighting and creates an "ipython" theme in its CSS:


However, highlighting in nbconvert is handled by pygments, that means you can't use codemirror CSS directly. That's fine since you wanted this for LaTeX export, and not HTML export (for that, see https://github.com/jupyter/nbconvert/issues/447).

But once you can reëncode the theme into pygments, then I think you will need to add a custom preprocessor or exporter in order to overwrite the default pygments theme, which is applied at https://github.com/jupyter/nbconvert/blob/master/nbconvert/preprocessors/latex.py.

Ok that should be enough to get you started, though I'm sure there are other areas where you'll run into friction. 

Please, update me if you succeed (including any details I didn't include here), either on the mailing list or as an issue on https://github.com/jupyter/nbconvert.
What you learn may able to be put to use elsewhere :), in the docs if not the core code itself.

--


You received this message because you are subscribed to the Google Groups "Project Jupyter" group.


To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+u...@googlegroups.com.


To post to this group, send email to jup...@googlegroups.com.


To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/c8645a52-9b14-403c-a43b-96b4f2b27614%40googlegroups.com.


For more options, visit https://groups.google.com/d/optout.


Mike Pacer

unread,
Dec 29, 2016, 2:02:06 PM12/29/16
to jup...@googlegroups.com
You also may need to touch this: https://github.com/jupyter/nbconvert/blob/master/nbconvert/filters/highlight.py if you end up needing to subclass `LatexFormatter()`.

Gandalf Saxe

unread,
Dec 29, 2016, 4:31:08 PM12/29/16
to Project Jupyter
Ah ok. Well if it's not just a default theme that I can pick in the LaTeX package "minted", I won't bother. Too much work for too little gain. But thanks for your answer anyway, perhaps someone else will pick it up :-)
Reply all
Reply to author
Forward
0 new messages