Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

Auto apply theme to mo.ui.data_explorer based on the notebook display theme (#2233)

Myles Scolnick0834aa935430
diff --git a/frontend/src/plugins/impl/data-explorer/ConnectedDataExplorerComponent.tsx b/frontend/src/plugins/impl/data-explorer/ConnectedDataExplorerComponent.tsx
index 875e6f1730..1bb00c4a35 100644
--- a/frontend/src/plugins/impl/data-explorer/ConnectedDataExplorerComponent.tsx
+++ b/frontend/src/plugins/impl/data-explorer/ConnectedDataExplorerComponent.tsx
@@ -23,6 +23,7 @@ import { ColumnSummary } from "./components/column-summary";
import type { VegaLiteProps } from "react-vega/lib/VegaLite";
import { useOnMount } from "@/hooks/useLifecycle";
import type { ChartSpec } from "./state/types";
+import { useTheme } from "@/theme/useTheme";
/**
* @param label - a label of the table
@@ -104,6 +105,7 @@ export const DataExplorerComponent = ({
const { mark } = useAtomValue(chartSpecAtom);
const charts = useAtomValue(relatedChartSpecsAtom);
+ const { theme } = useTheme();
if (error) {
return <ErrorBanner error={error} />;
@@ -133,6 +135,7 @@ export const DataExplorerComponent = ({
padding={PADDING}
actions={ACTIONS}
spec={makeResponsive(mainPlot.spec)}
+ theme={theme === "dark" ? "dark" : undefined}
/>
</div>
);
@@ -207,6 +210,7 @@ export const DataExplorerComponent = ({
key={idx}
actions={false}
spec={plot.spec}
+ theme={theme === "dark" ? "dark" : undefined}
/>
</HorizontalCarouselItem>
))}