问题
I would like to use another theme for Ipython notebook so I following this instructions the problem is I'm in OSX and I dont have the wget, I installed it homebrew. Could somebody help me to set ipython notebooks in a dark theme?. I tried this:
brew /Users/user/.ipython/profile_notebooks/static/custom/custom.css
https://raw.githubusercontent.com/nsonnad/base16-ipython-notebook/master/base16-ocean-dark.css
回答1:
You can do it with curl
or by manually downloading the theme. I have given steps for both the options below.
Create a custom profile using the following command:
ipython profile create ocean
Replace the content of the default stylesheet custom.css
with that of the required theme using the following command
Using curl:
curl -o `ipython locate profile ocean`/static/custom/custom.css https://raw.githubusercontent.com/nsonnad/base16-ipython-notebook/master/base16-ocean-dark.css
Start the IPython
notebook by specifying the custom profile e.g.
ipython notebook --profile=ocean
Alternative:
If you are not able to download using curl
, you can simply download the base16-ocean-dark.css
and replace the custom.css
in the custom directory of your created profile.
Locate the profile directory:
ipython locate profile ocean
Go to its static/custom
directory and replace the content of custom.css
with that of downloaded css
file.
Start the IPython
notebook by specifying the custom profile as shown above.
回答2:
Amit's answer isn't fit for ipython=>4.0
, as jupyter
is divided from it now.
You can try jupyter-themes.
It is suit for ipython=>4.0
and much more easy to install.
Install jupyter-themes
$ pip install --upgrade jupyterthemes
Pick a theme and install
# list themes (located in ~/.jupyter-themes) $ jt -l # install theme (-t) for jupyter nb # theme names: oceans16 | grade3 | space-legos $ jt -t grade3 # install a theme (-t) with toolbar (-T) enabled $ jt -T -t grade3 # install a theme (-t) and set font-size (-f), default value is 11 $ jt -f 12 -t grade3 # reset (-r) to default for jupyter theme $ jt -r
回答3:
I've added jupyter-themes to pypi under the name jupyterthemes.
To install the latest version:
#uninstall any old versions
pip uninstall jupyter-themes
#install the latest version (no hyphen)
pip install jupyterthemes
Hopefully that takes care of any issues people were having with themes not showing up (@llya).
来源:https://stackoverflow.com/questions/27954158/problems-setting-up-a-new-theme-in-ipython