Skip to content

Commit faecf07

Browse files
committed
Fix marimo theme detection
1 parent 3b36151 commit faecf07

File tree

7 files changed

+10
-11
lines changed

7 files changed

+10
-11
lines changed

changelog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
- Allow setting the theme manually in `VG.render(theme="light")` and `VG.render_widget(theme="dark")`.
1919
- Use typed nodes and relationship traitlets in GraphWidget, i.e., list of Node and Relationship instead of dictionaries.
2020
- `render` now allows to pass `layout` as a string as well. Previously expected to be a typed `neo4j_viz.Layout`.
21-
- Fixed rendering in Marimo notebooks. Note, you still have to manually pass the marimo theme `VG.render_widget(theme=marimo.app_meta().theme)`
21+
- Fixed rendering in Marimo notebooks
2222

2323

2424
## Other changes

examples/.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
.ipynb_checkpoints
2-
2+
__marimo__
33
out/*
4-
/__marimo__/session/*
4+

examples/marimo-example.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ def _(mo):
6666

6767

6868
@app.cell
69-
def _(VisualizationGraph, mo, nodes, relationships):
69+
def _(VisualizationGraph, nodes, relationships):
7070
# Create and render the visualization
7171
VG = VisualizationGraph(nodes=nodes, relationships=relationships)
7272
# Note, we need to pass the theme explicitly in Marimo.
73-
widget = VG.render_widget(theme=mo.app_meta().theme, renderer="canvas")
73+
widget = VG.render_widget(renderer="canvas")
7474
widget
7575
return VG, widget
7676

js-applet/src/graph-widget.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ export type WidgetData = {
3737
};
3838

3939
function detectTheme(): "light" | "dark" {
40-
if (document.body.classList.contains("vscode-light")) {
40+
if (document.body.classList.contains("vscode-light") || document.body.classList.contains("light-theme")) {
4141
return "light";
4242
}
43-
if (document.body.classList.contains("vscode-dark")) {
43+
if (document.body.classList.contains("vscode-dark") || document.body.classList.contains("dark-theme")) {
4444
return "dark";
4545
}
4646

python-wrapper/src/neo4j_viz/resources/nvl_entrypoint/index.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

python-wrapper/src/neo4j_viz/resources/nvl_entrypoint/widget.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82204,9 +82204,9 @@ class Hdr extends kr.Component {
8220482204
}
8220582205
}
8220682206
function Vdr() {
82207-
if (document.body.classList.contains("vscode-light"))
82207+
if (document.body.classList.contains("vscode-light") || document.body.classList.contains("light-theme"))
8220882208
return "light";
82209-
if (document.body.classList.contains("vscode-dark"))
82209+
if (document.body.classList.contains("vscode-dark") || document.body.classList.contains("dark-theme"))
8221082210
return "dark";
8221182211
const r = window.getComputedStyle(document.body, null).getPropertyValue("background-color").match(/\d+/g);
8221282212
if (!r || r.length < 3)

scripts/clean_js_applet.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,4 @@ set -o pipefail
77
(
88
cd "${GIT_ROOT}/js-applet"
99
rm -rf node_modules
10-
rm -f yarn.lock
1110
)

0 commit comments

Comments
 (0)