1

I'm using the Base16 Ocean dark theme on IPython Notebook.

The background color of selected text doesn't contrast very well, making it difficult to tell if it's selected:

enter image description here

On the default settings, this does not occur:

enter image description here

Please let me know how to change the background color of selected code on IPython Notebook to a more clear one.

3 Answers 3

8

Run the following code in a notebook to find out the jupyter config folder on your system, if you don't know it yet:

from jupyter_core.paths import jupyter_config_dir
jupyter_dir = jupyter_config_dir()
print(jupyter_dir)

In the jupyter config folder, find /custom/custom.css, modify the following line:

.cm-s-ipython div.CodeMirror-selected {background: #384151 !important;}

I use '#3366ff' here, you may use whatever background color that suits your need.

Sign up to request clarification or add additional context in comments.

1 Comment

It actually works: css edit & save -> notebook reload -> we're good!
2

All is well with jimmyazrael answer, but if you're using Jupyter 5.0 from within Anaconda3 you will find your css file at:

C:\Users\YourUsername\Anaconda3\Lib\site-packages\notebook\static\cutom\custom.css

Hope that helped

Comments

0

Mine was I bit more complicated. Couldn't find it in any mentioned folder, thus after searching my system for "custom.css", I have found many of this! It is likely because I had upgraded/downgraded my environment multiple times.

So, in the end, I open the file in:

C:\Users\username\AppData\Local\Continuum\anaconda3\pkgs\notebook-6.1.5-py37haa95532_0\Lib\site-packages\notebook\static\custom\custom.css

Pasted the line:

.cm-s-ipython div.CodeMirror-selected {background: #384151 !important;}

Saved and restarted Jupyter. It worked!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.