#15155·bokeh

Dark mode impacts bokeh json_item / embed

Author: a-gertnerCreated Jun 17, 2026Updated Sep 23, 2026
LabelsTRIAGEtag: CSS

Software versions

Windows11 Python version: 3.11 Bokeh version: 3.10.0-dev4+13 / 3.10.0-dev.5

Browser name and version

No response

Jupyter notebook / Jupyter Lab version

No response

Expected behavior

Bokeh elements behave consistently when rendered in Jupyter / bokeh.io.show / using bokeh.embed.json_item

Observed behavior

When using json_item + Bokeh.embed some elements get weird styling when OS theme switched to dark mode.

Example code

python
import json

import bokeh
from bokeh.embed import json_item
from bokeh.plotting import figure

# Create a simple plot
p = figure(
    title=f"{bokeh.__version__}",
    height=450,
)
p.line([1, 2, 3], [4, 6, 5])

# Serialize plot
item = json_item(p, "myplot")

# Minimal valid HTML
html = f"""
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <script src="https://cdn.bokeh.org/bokeh/release/bokeh-3.9.1.min.js"></script>
</head>
<body>
    <div id="myplot"></div>

    <script type="application/json" id="plotdata">
        {json.dumps(item)}
    </script>

    <script>
        const item = JSON.parse(document.getElementById('plotdata').textContent);
        Bokeh.embed.embed_item(item);
    </script>
</body>
</html>
"""

# Save file
with open("bokeh_json_item_example.html", "w") as f:
    f.write(html)

Example above works as expected with bokeh v3.9.1. Replace bokeh with 3.10.0-dev4 and the bug appears.

Stack traceback or browser console output

No response

Screenshots

Note how toolbar background goes dark in v3.10-dev. This behaviour is not consistent with simple use of bokeh.io.show() Image

Image