4

When I select text of input cells in Jupyter Notebook on Ubuntu in Chromium, I can barely see the highlight. Like this (everything after "100" is highlighted):

weakly highlighted

On output cells I can easily see the highlighted text (blue background):

enter image description here

How can I fix this? It's hard to do copy-paste edits on input cells when I can barely see what I've selected.

Lars Ericson
  • 1,952
  • 4
  • 32
  • 45

2 Answers2

2

Follow these steps:

  1. Find your configuration folder (I will assume it is ~/.jupyter) with

    import jupyter_core
    jupyter_core.paths.jupyter_config_dir()
    

    You can easily find what would be the corresponding directory for Windows, if needed.

  2. Create a folder ~/.jupyter/custom, if it does not exist. Other folders might also work (How do I set custom CSS for my IPython/IHaskell/Jupyter Notebook?).

  3. Create an empty file ~/.jupyter/custom/custom.css, if it does not exist.

  4. Add

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

    to your custom.css. Use a suitable color.

  5. Reload your notebook in the browser, for immediate results.

1

I solved by loading jupyter notebook from Terminal (not anaconda), once loaded, I looked for the .css in the execution files that load in the terminal window, and found the styling file.

The file name is style.min.css

/home/<user>/anaconda3/lib/python3.6/site-packages/notebook/static/style/style.min.css

ctrl + f to browse inside the file and your set!

FYI my version of jn:

$ jupyter notebook --version
6.0.0
RobC
  • 22,977
  • 20
  • 73
  • 80