[IPython-dev] [IPython-User] changing color theme for paired brackets in notebook

Matthias BUSSONNIER bussonniermatthias at gmail.com
Mon May 26 12:51:11 EDT 2014


Hi Jean-François, 

Le 26 mai 2014 à 15:41, Jean-Francois.Moulin at hzg.de a écrit :

> 
> Hi!
> 
> could anyone point me to a way to tune the color scheme of the ipython notebook? In particular I want to change the color used to highlight paired brackets when the cursor is on one of them (On my machine and with my light colorblindness, the color used is almost indistinguishable from the background)

Is this the only color you wish to override or do you want a more custom theme ? 
If the first one you can just create a custom css file, the second one you might want to rebuild the full IPython css theme. 

In both cases, put a css file in your ipython profile, one static/custom/custom/custom.css

for me ~/.ipython/profile_default/static/custom/custom.css	
it should already exist and have a comment that look like 

/*
Placeholder for custom user CSS

mainly to be overridden in profile/static/custom/custom.css

This will always be an empty file in IPython
*/

According to codemirror Doc [1] you can style the bracket by targeting the following class : 

CodeMirror-matchingbracket


which mean that the following should work : 

div.CodeMirror span.CodeMirror-matchingbracket {
    color:red;
}

use any color or style you like. 

you can also use any code mirror predefined style if you prefer [2], but it might require a little more of tweaking. 
Here [3] are a few full theme for IPython notebook. 

Cheers, 

-- 
Matthias



[1] : http://codemirror.net/doc/manual.html#class_CodeMirror_matchingbracket
[2] : http://codemirror.net/demo/theme.html
[3] : https://github.com/nsonnad/base16-ipython-notebook



> 
> Many thanks in advance
> JF
> Helmholtz-Zentrum Geesthacht 
> Zentrum für Material- und Küstenforschung GmbH 
> Max-Planck-Straße 1 I 21502 Geesthacht I Deutschland/Germany 
> 
> Geschäftsführer/Board of Management: Prof. Dr. Wolfgang Kaysser, Dipl.-Ing. Michael Ganß 
> Vorsitzender des Aufsichtsrates/Chairman of the Supervisory Board: MinDirig Wilfried Kraus 
> Amtsgericht Lübeck HRB 285 GE (Register Court) 
> Internet: http://www.hzg.de  
> _______________________________________________
> IPython-User mailing list
> IPython-User at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-user

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20140526/0ad74b68/attachment.html>


More information about the IPython-dev mailing list