I am using JupyterLab with light theme and when I exported my notebook as HTML I saw this:
What I am expecting to see is something like this:
any ideas of the setting ?
Run "pip install jupyterthemes" This should show you the themes installed/ cached by jupyter notebook. Now run "jt -r" to reset the theme to default as shown below. Open and test jupyter notebook. Theme should be gone now.
This method is as simple as clicking File, Download as, HTML (. html). Jupyter will then download the notebook as an HTML file to wherever the browser defaults for downloaded files. Screenshot of export by author.
By default, Jupyter Notebook uses the light theme. Some of the programmers or data scientists like to use some dark themes or other themes on different platform such as PyCharm, Spyder, etc. Jupyter Notebook does not come up with an inbuilt option to change the theme of the notebook.
Alternatively, the complete Jupyter notebook is at this link: Sample_ipynb.ipynb First, we export the notebook as html file: Fig. 2. Exporting notebook as .html file. Printing the notebook directly (File -> Print Preview -> print (Ctrl+P)) to a printer device renders the notebook in black and white 2. Fig. 3.
Download Jupyter Notebook as HTML The most strightforward way to get HTML file from Jupyter Notebook is to use Download as function inside the Jupyter application. Please click on File in the top navigation bar, and then Download as to see many options of download formats (PDF, HTML, Python, LaTeX). Please select HTML (.html).
If you are not interested in dark mode, you can try this following themes Alternative themes in Jupyter Notebook (Image by Author). Left: gruvboxd themes, middle: monokai, Right: solarizedd. Light themes in Jupyter Notebook (Image by Author).
One way to suppress visibility of code cell is to use JQuery (javascript) in the separate Jupyter cell as per 4, 5: We can toggle visibility of the code in the html report (rendered output) displayed in the browser.
I had the exact same issue. After a couple hours debugging I realized it had to do (for me at least) with the jupyter-theme
library. I had a dark theme installed, and I think nbconverter
uses whichever settings your jupyter
is also using, so the dark settings were affecting the html conversion.
Solution was simply to restore defaults with:
$ jt -r
If that doesn't work, then refer to this thread: https://github.com/dunovank/jupyter-themes/issues/86
from the command line run:
jupyter nbconvert --execute --to html /path/to/example.ipynb --HTMLExporter.theme=dark
adding --execute
guarantees that plots are rendered before saving.
you can use Plotly dark theme to have plots black as well
import plotly.io as pio
pio.templates.default = "plotly_dark"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With