Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can i change the code block cell color? #548

Closed
fcarvalhopacheco opened this issue Apr 17, 2022 · 3 comments
Closed

How can i change the code block cell color? #548

fcarvalhopacheco opened this issue Apr 17, 2022 · 3 comments
Labels

Comments

@fcarvalhopacheco
Copy link

fcarvalhopacheco commented Apr 17, 2022

Describe the bug

Context

When I click on the Run code button, the code block cell color changes completely from my furo dark theme.

This is the dark theme of furo before running Run code button. Please check the repository here

Screen Shot 2022-04-16 at 15 58 16

This is what happened after running the Run code button.

Screen Shot 2022-04-16 at 15 58 25

Expectation

I expected the code block color to be the same or match the furo dark theme (ps. the light theme has a wonderful match...) . I have already tried to change pygments_dark_style = " " but the code block colors will not change. Also, I am a big fan of "monokai" style.

Does anyone have any suggestions? Have a wonderful week/weekend =)

Reproduce the bug

  1. Go to (https://oop-learning.readthedocs.io/en/latest/contents/oop-fundamentals/2.oop-fundamentals.html)
  2. Run any code block by clicking on Run code

List your environment

Name Version Build Channel
alabaster 0.7.12 py_0 conda-forg
anyio 3.5.0 py310h2ec42d9_0 conda-forg
appnope 0.1.3 pyhd8ed1ab_0 conda-forg
argon2-cffi 21.3.0 pyhd8ed1ab_0 conda-forg
argon2-cffi-bindings 21.2.0 py310h1961e1f_2 conda-forg
asttokens 2.0.5 pyhd8ed1ab_0 conda-forg
attrs 21.4.0 pyhd8ed1ab_0 conda-forg
babel 2.9.1 pyh44b312d_0 conda-forg
backcall 0.2.0 pyh9f0ad1d_0 conda-forg
backports 1.0 py_2 conda-forg
backports.functools_l u_cache 1.6.4 pyhd8ed1ab0 condaforge
beautifulsoup4 4.11.1 pyha770c72_0 conda-forg
bleach 5.0.0 pyhd8ed1ab_0 conda-forg
bokeh 2.4.2 py310h2ec42d9_1 conda-forg
branca 0.4.2 pyhd8ed1ab_0 conda-forg
brotlipy 0.7.0 py310h1961e1f_100 conda-f
bzip2 1.0.8 h0d85af4_4 conda-forg
ca-certificates 2021.10.8 h033912b_0 conda-forg
certifi 2021.10.8 py310h2ec42d9_2 conda-forg
cffi 1.15.0 py310hcc37b68_0 conda-forg
charset-normalizer 2.0.12 pyhd8ed1ab_0 conda-forg
click 8.1.2 py310h2ec42d9_0 conda-forg
click-completion 0.5.2 py310h2ec42d9_3 conda-forg
click-log 0.3.2 pyh9f0ad1d_0 conda-forg
colorama 0.4.4 pyh9f0ad1d_0 conda-forg
cryptography 36.0.0 py310hf6deb26_0
debugpy 1.6.0 py310h9d931ec_0 conda-forg
decorator 5.1.1 pyhd8ed1ab_0 conda-forg
defusedxml 0.7.1 pyhd8ed1ab_0 conda-forg
docutils 0.17.1 py310h2ec42d9_1 conda-forg
entrypoints 0.4 pyhd8ed1ab_0 conda-forg
executing 0.8.3 pyhd8ed1ab_0 conda-forg
flit-core 3.7.1 pyhd8ed1ab_0 conda-forg
folium 0.12.1.post1 pyhd8ed1ab_1 conda-forg
freetype 2.10.4 h4cff582_1 conda-forg
furo 2022.4.7 pyhd8ed1ab_0 conda-forg
giflib 5.2.1 hbcb3906_2 conda-forg
gitdb 4.0.9 pyhd8ed1ab_0 conda-forg
gitpython 3.1.27 pyhd8ed1ab_0 conda-forg
greenlet 1.1.2 py310h9d931ec_2 conda-forg
idna 3.3 pyhd8ed1ab_0 conda-forg
imagesize 1.3.0 pyhd8ed1ab_0 conda-forg
importlib-metadata 4.11.3 py310h2ec42d9_1 conda-forg
importlib_resources 5.7.0 pyhd8ed1ab_0 conda-forg
ipykernel 6.13.0 py310ha188af9_0 conda-forg
ipython 8.1.1 py310h2ec42d9_0 conda-forg
ipython_genutils 0.2.0 py_1 conda-forg
ipywidgets 7.7.0 pyhd8ed1ab_0 conda-forg
jbig 2.1 h0d85af4_2003 conda-forg
jedi 0.18.1 py310h2ec42d9_1 conda-forg
jinja2 3.1.1 pyhd8ed1ab_0 conda-forg
jpeg 9e h0d85af4_0 conda-forg
jsonschema 4.4.0 pyhd8ed1ab_0 conda-forg
jupyter-cache 0.4.3 pyhd8ed1ab_0 conda-forg
jupyter-server-mathja 0.2.5 pyhc268e32_0 conda-forg
jupyter-sphinx 0.3.2 pyhd8ed1ab_1 conda-forg
jupyter_client 7.2.2 pyhd8ed1ab_1 conda-forg
jupyter_core 4.9.2 py310h2ec42d9_0 conda-forg
jupyter_server 1.16.0 pyhd8ed1ab_1 conda-forg
jupyterlab_pygments 0.2.2 pyhd8ed1ab_0 conda-forg
jupyterlab_widgets 1.1.0 pyhd8ed1ab_0 conda-forg
lcms2 2.12 h577c468_0 conda-forg
lerc 3.0 he49afe7_0 conda-forg
libblas 3.9.0 14_osx64_openblas conda-fo
libcblas 3.9.0 14_osx64_openblas conda-fo
libcxx 13.0.1 hc203e6f_0 conda-forg
libdeflate 1.10 h0d85af4_0 conda-forg
libffi 3.4.2 h0d85af4_5 conda-forg
libgfortran 5.0.0 9_3_0_h6c81a4c_23 conda-fo
libgfortran5 9.3.0 h6c81a4c_23 conda-forg
liblapack 3.9.0 14_osx64_openblas conda-fo
libopenblas 0.3.20 openmp_hb3cd9ec_0 conda-fo
libpng 1.6.37 h7cec526_2 conda-forg
libsodium 1.0.18 hbcb3906_1 conda-forg
libtiff 4.3.0 h17f2ce3_3 conda-forg
libwebp 1.2.2 h28dabe5_0 conda-forg
libwebp-base 1.2.2 h0d85af4_1 conda-forg
libxcb 1.13 h0d85af4_1004 conda-forg
libzlib 1.2.11 h6c3fc93_1014 conda-forg
livereload 2.6.3 pyh9f0ad1d_0 conda-forg
llvm-openmp 13.0.1 hcb1a161_1 conda-forg
lz4-c 1.9.3 he49afe7_1 conda-forg
markdown-it-py 1.1.0 pyhd8ed1ab_0 conda-forg
markupsafe 2.1.1 py310h1961e1f_1 conda-forg
matplotlib-inline 0.1.3 pyhd8ed1ab_0 conda-forg
mdit-py-plugins 0.2.8 pyhd8ed1ab_0 conda-forg
mistune 0.8.4 py310he24745e_100 conda-f
myst-nb 0.13.1 pyhd8ed1ab_0 conda-forg
myst-parser 0.15.2 pyhd8ed1ab_0 conda-forg
nbclient 0.5.13 pyhd8ed1ab_0 conda-forg
nbconvert 6.5.0 pyhd8ed1ab_0 conda-forg
nbconvert-core 6.5.0 pyhd8ed1ab_0 conda-forg
nbconvert-pandoc 6.5.0 pyhd8ed1ab_0 conda-forg
nbdime 3.1.1 pyhd8ed1ab_0 conda-forg
nbformat 5.3.0 pyhd8ed1ab_0 conda-forg
ncurses 6.3 h96cf925_1 conda-forg
nest-asyncio 1.5.5 pyhd8ed1ab_0 conda-forg
notebook 6.4.10 pyha770c72_0 conda-forg
numpy 1.22.3 py310hb608527_2 conda-forg
openjpeg 2.4.0 h6e7aa92_1 conda-forg
openssl 3.0.2 h6c3fc93_1 conda-forg
packaging 21.3 pyhd8ed1ab_0 conda-forg
pandas 1.4.2 py310h514ec25_1 conda-forg
pandoc 2.18 h694c41f_0 conda-forg
pandocfilters 1.5.0 pyhd8ed1ab_0 conda-forg
parso 0.8.3 pyhd8ed1ab_0 conda-forg
pexpect 4.8.0 pyh9f0ad1d_2 conda-forg
pickleshare 0.7.5 py_1003 conda-forg
pillow 9.1.0 py310h382dc3b_2 conda-forg
pip 22.0.4 pyhd8ed1ab_0 conda-forg
prometheus_client 0.14.1 pyhd8ed1ab_0 conda-forg
prompt-toolkit 3.0.29 pyha770c72_0 conda-forg
psutil 5.9.0 py310h1961e1f_1 conda-forg
pthread-stubs 0.4 hc929b4f_1001 conda-forg
ptyprocess 0.7.0 pyhd3deb0d_0 conda-forg
pure_eval 0.2.2 pyhd8ed1ab_0 conda-forg
pycparser 2.21 pyhd8ed1ab_0 conda-forg
pygments 2.11.2 pyhd8ed1ab_0 conda-forg
pyopenssl 22.0.0 pyhd8ed1ab_0 conda-forg
pyparsing 3.0.8 pyhd8ed1ab_0 conda-forg
pyrsistent 0.18.1 py310h1961e1f_1 conda-forg
pysocks 1.7.1 py310h2ec42d9_5 conda-forg
python 3.10.4 h1cc4136_0_cpytho conda-f
python-dateutil 2.8.2 pyhd8ed1ab_0 conda-forg
python-fastjsonschema 2.15.3 pyhd8ed1ab_0 conda-forg
python_abi 3.10 2_cp310 conda-forg
pytz 2022.1 pyhd8ed1ab_0 conda-forg
pyyaml 6.0 py310h1961e1f_4 conda-forg
pyzmq 22.3.0 py310h138f930_2 conda-forg
readline 8.1 h05e3726_0 conda-forg
requests 2.27.1 pyhd8ed1ab_0 conda-forg
send2trash 1.8.0 pyhd8ed1ab_0 conda-forg
setuptools 62.1.0 py310h2ec42d9_0 conda-forg
shellingham 1.4.0 pyh44b312d_0 conda-forg
six 1.16.0 pyh6c4a22f_0 conda-forg
smmap 3.0.5 pyh44b312d_0 conda-forg
sniffio 1.2.0 py310h2ec42d9_3 conda-forg
snowballstemmer 2.2.0 pyhd8ed1ab_0 conda-forg
soupsieve 2.3.1 pyhd8ed1ab_0 conda-forg
sphinx 4.4.0 pyh6c4a22f_1 conda-forg
sphinx-autobuild 2021.3.14 pyhd8ed1ab_0 conda-forg
sphinx-autodoc-typehi ts 1.12.0 pyhd8ed1ab_0 conda-forg
sphinx-design 0.0.13 pyhd8ed1ab_0 conda-forg
sphinx-inline-tabs 2022.1.2b11 pyhd8ed1ab_0 conda-forg
sphinx-thebe 0.1.1 pyhd8ed1ab_0 conda-forg
sphinx-togglebutton 0.2.3 pyhd3deb0d_0 conda-forg
sphinxcontrib-applehe p 1.0.2 py_0 conda-forg
sphinxcontrib-devhelp 1.0.2 py_0 conda-forg
sphinxcontrib-htmlhel 2.0.0 pyhd8ed1ab_0 conda-forg
sphinxcontrib-jsmath 1.0.1 py_0 conda-forg
sphinxcontrib-qthelp 1.0.3 py_0 conda-forg
sphinxcontrib-seriali inghtml 1.1.5 pyhd8ed1ab 2 conda-
sqlalchemy 1.4.35 py310h1961e1f_0 conda-forg
sqlite 3.38.2 hb516253_0 conda-forg
stack_data 0.2.0 pyhd8ed1ab_0 conda-forg
terminado 0.13.3 py310h2ec42d9_1 conda-forg
tinycss2 1.1.1 pyhd8ed1ab_0 conda-forg
tk 8.6.12 h5dbffcc_0 conda-forg
tornado 6.1 py310h1961e1f_3 conda-forg
traitlets 5.1.1 pyhd8ed1ab_0 conda-forg
typing_extensions 4.1.1 pyha770c72_0 conda-forg
tzdata 2022a h191b570_0 conda-forg
urllib3 1.26.9 pyhd8ed1ab_0 conda-forg
wcwidth 0.2.5 pyh9f0ad1d_2 conda-forg
webencodings 0.5.1 py_1 conda-forg
websocket-client 1.3.2 pyhd8ed1ab_0 conda-forg
wheel 0.37.1 pyhd8ed1ab_0 conda-forg
widgetsnbextension 3.6.0 py310h2ec42d9_0 conda-forg
xorg-libxau 1.0.9 h35c211d_0 conda-forg
xorg-libxdmcp 1.1.3 h35c211d_0 conda-forg
xz 5.2.5 haf1e3a3_1 conda-forg
yaml 0.2.5 h0d85af4_2 conda-forg
zeromq 4.3.4 he49afe7_1 conda-forg
zipp 3.8.0 pyhd8ed1ab_0 conda-forg
zlib 1.2.11 h6c3fc93_1014 conda-forg
zstd 1.5.2 h582d3a0_0 conda-forg
@welcome
Copy link

welcome bot commented Apr 17, 2022

Thanks for opening your first issue here! Engagement like this is essential for open source projects! 🤗

If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.

If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).

Welcome to the EBP community! 🎉

@stevejpurves
Copy link
Collaborator

stevejpurves commented Apr 18, 2022

Looks like this is undocumented but it looks like it is possible to set theme like so:

{
   binderOptions: {
       codeMirrorOptions: {
           theme: "duotone-dark"
       }
   }
}

which will trigger a load of CSS via requirejs https://github.com/executablebooks/thebe/blob/master/src/render.js#L265
The would allow you to control and set the theme when bootstrapping.

@fcarvalhopacheco
Copy link
Author

fcarvalhopacheco commented Apr 18, 2022

Thanks for the reply Steve!

I forgot to mention that I am actually using sphinx-thebe. Perhaps should have opened the issue over there (executablebooks/sphinx-thebe#39; executablebooks/sphinx-book-theme#393). Sorry about that. There is also this Reference here

However, I am still trying to work on this since the following is also not working…

thebe_config = {
    "codemirror-theme": "monokai",
    "always_load": True,
}

This is my conf.py

import os
import sys

sys.path.insert(0, os.path.abspath('.'))

# -- Project information -----------------------------------------------------

project = 'oop-python-learning'
copyright = '2022, Fernando Carvalho Pacheco'
author = 'Fernando Carvalho Pacheco'

# The full version, including alpha/beta/rc tags
release = '0.0.1'

# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.

extensions = [
    "myst_nb",
    "sphinx.ext.autodoc",
    "sphinx.ext.napoleon",
    "sphinx_autodoc_typehints",
    "sphinx.ext.intersphinx",
    "sphinx.ext.autosectionlabel",
    "sphinx_design",
    "sphinx_thebe",
]

myst_enable_extensions = [
    "colon_fence",
]

# Make sure the explicity target is unique
autosectionlabel_prefix_document = True
autosectionlabel_maxdepth = 3

myst_heading_anchors = 3

source_suffix = {
    '.ipynb': 'myst-nb',
    '.myst': 'myst-nb',
    '.md': 'myst-nb',
}

autosectionlabel_prefix_document = True


# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'build', 'Thumbs.db', '.DS_Store', '.env', '**.ipynb_checkpoints']

pygments_style = 'sphinx'
pygments_dark_style = "monokai"
# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages.  See the documentation for
# a list of builtin themes.
#
html_theme = 'furo'

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']

html_theme_options = {
    "navigation_with_keys": True,
}

html_title = "OOP Python"


# -- Jupyter options ---------------------------------------------------------
jupyter_execute_notebooks = "auto"

thebe_config = {
    "codemirror-theme": "monokai",
    "always_load": True,
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants