From 95f6fd094035c12e0975ea4a5d5876f2110492b6 Mon Sep 17 00:00:00 2001 From: Carson Date: Thu, 15 Oct 2026 10:09:40 -0500 Subject: [PATCH 1/4] fix(py): restore __version__ in viz_dep to unbreak _viz_tools import A previous commit on this branch made viz_dep() use a dep_version() helper whose definition was never committed, so importing querychat._viz_tools raised ImportError and the Python CI job on #323 failed at collection time. Restore the direct __version__ usage. --- pkg-py/src/querychat/_viz_tools.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/pkg-py/src/querychat/_viz_tools.py b/pkg-py/src/querychat/_viz_tools.py index 7ac65a4c9..684d33ade 100644 --- a/pkg-py/src/querychat/_viz_tools.py +++ b/pkg-py/src/querychat/_viz_tools.py @@ -17,14 +17,10 @@ from shiny import ui +from .__version import __version__ from ._icons import bs_icon from ._tool_names import TOOL_VISUALIZE -from ._utils import ( - dep_version, - querychat_tool_starts_open, - read_prompt_template, - truncate_error, -) +from ._utils import querychat_tool_starts_open, read_prompt_template, truncate_error from ._viz_altair_widget import AltairWidget, fit_chart_to_container from ._viz_ggsql import ( ExecutorReader, @@ -303,7 +299,7 @@ def viz_dep() -> HTMLDependency: """HTMLDependency for viz-specific CSS and JS assets.""" return HTMLDependency( "querychat-viz", - dep_version(), + __version__, source={ "package": "querychat", "subdir": "static", From 5a92610ec3ef8a25a24a2fa7dc8380ee75a761bb Mon Sep 17 00:00:00 2001 From: Carson Date: Thu, 15 Oct 2026 10:09:50 -0500 Subject: [PATCH 2/4] fix(py): let the prism theme set the query-section editor background viz.css forced background-color: var(--bs-light) on .prism-code-editor inside .querychat-query-section, so in dark mode the github-dark syntax theme's light text rendered on a forced light background (light-on-light, illegible). Drop the override so the active prism theme's --editor__bg applies (github-light #fff / github-dark #0d1117); shiny's code editor already switches themes with data-bs-theme. Affects both the viz footer's "Show Query" editor and the data drawer's SQL editor, which share the .querychat-query-section wrapper. --- pkg-py/src/querychat/static/css/viz.css | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg-py/src/querychat/static/css/viz.css b/pkg-py/src/querychat/static/css/viz.css index 508054d5c..1af6952ce 100644 --- a/pkg-py/src/querychat/static/css/viz.css +++ b/pkg-py/src/querychat/static/css/viz.css @@ -184,7 +184,10 @@ } .querychat-query-section bslib-code-editor .prism-code-editor { - background-color: var(--bs-light, #f8f8f8); + /* No background override: the active prism theme sets --editor__bg + (github-light/github-dark) to match the app's color mode. Forcing a + fixed light background here rendered dark-mode (light) syntax text + on a light background. */ max-height: 200px; overflow-y: auto; } From 0ffc327bc95c015db0483388ab51751ffe2b1b1a Mon Sep 17 00:00:00 2001 From: Carson Date: Thu, 15 Oct 2026 10:10:38 -0500 Subject: [PATCH 3/4] docs(py): changelog entry for dark-mode SQL editor fix (#328) --- pkg-py/CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg-py/CHANGELOG.md b/pkg-py/CHANGELOG.md index dae1b7fdc..a5f064aea 100644 --- a/pkg-py/CHANGELOG.md +++ b/pkg-py/CHANGELOG.md @@ -17,6 +17,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * JSON pins now fall back to `pin_read()` when DuckDB's JSON extension cannot be installed or loaded, including on builds that disable extension loading. Native DuckDB JSON reading is retained when the extension is available. +* Fixed SQL code blocks (the visualization footer's "Show Query" editor and the data drawer's SQL editor) rendering illegibly in dark mode — light syntax-highlighted text on a forced light background. The editor background now follows the active syntax theme. (#328) + ## [0.9.0] - 2026-09-13 ### New features From 3ed0ecd5e5bec5ced8a00f4ed22041f90d6facb6 Mon Sep 17 00:00:00 2001 From: Carson Date: Thu, 15 Oct 2026 10:12:41 -0500 Subject: [PATCH 4/4] fix: apply query-section editor background fix to shared CSS source The previous commit edited the generated pkg-py copy of viz.css directly; the source of truth is js/src/viz.css, which also feeds pkg-r/inst/htmldep/viz.css. --- js/src/viz.css | 5 ++++- pkg-r/inst/htmldep/viz.css | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/js/src/viz.css b/js/src/viz.css index 959e33e57..d516d2f8f 100644 --- a/js/src/viz.css +++ b/js/src/viz.css @@ -183,7 +183,10 @@ } .querychat-query-section bslib-code-editor .prism-code-editor { - background-color: var(--bs-light, #f8f8f8); + /* No background override: the active prism theme sets --editor__bg + (github-light/github-dark) to match the app's color mode. Forcing a + fixed light background here rendered dark-mode (light) syntax text + on a light background. */ max-height: 200px; overflow-y: auto; } diff --git a/pkg-r/inst/htmldep/viz.css b/pkg-r/inst/htmldep/viz.css index 508054d5c..1af6952ce 100644 --- a/pkg-r/inst/htmldep/viz.css +++ b/pkg-r/inst/htmldep/viz.css @@ -184,7 +184,10 @@ } .querychat-query-section bslib-code-editor .prism-code-editor { - background-color: var(--bs-light, #f8f8f8); + /* No background override: the active prism theme sets --editor__bg + (github-light/github-dark) to match the app's color mode. Forcing a + fixed light background here rendered dark-mode (light) syntax text + on a light background. */ max-height: 200px; overflow-y: auto; }