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.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
improve dark mode (#264)
Myles Scolnick10a262b450fc
diff --git a/frontend/src/components/app-config/app-config-button.tsx b/frontend/src/components/app-config/app-config-button.tsxindex 7135c0db39..523f23e447 100644--- a/frontend/src/components/app-config/app-config-button.tsx+++ b/frontend/src/components/app-config/app-config-button.tsx@@ -35,7 +35,7 @@ export const AppConfigButton = () => {onFocusOutside={(evt) => evt.preventDefault()}><AppConfigForm />- <div className="h-px bg-gray-200 dark:bg-gray-700 my-4" />+ <div className="h-px bg-border my-4" /><UserConfigForm /></PopoverContent></Popover>diff --git a/frontend/src/css/App.css b/frontend/src/css/App.cssindex 39bba762b8..57a8d93abc 100644--- a/frontend/src/css/App.css+++ b/frontend/src/css/App.css@@ -61,8 +61,9 @@ html {opacity: 0.5;}-#App.disconnected,-#App.disconnected .transparent-when-disconnected {+/* Remove background when disconnected, only in light mode. */+.light #App.disconnected,+.light #App.disconnected .transparent-when-disconnected {background: none;}diff --git a/frontend/src/css/Cell.css b/frontend/src/css/Cell.cssindex 765f719e9d..db00f0f27d 100644--- a/frontend/src/css/Cell.css+++ b/frontend/src/css/Cell.css@@ -118,13 +118,13 @@}.tray:first-child .cm-editor {- border-top-left-radius: 10px;- border-top-right-radius: 10px;+ border-top-left-radius: 9px;+ border-top-right-radius: 9px;}.tray:last-child .cm-editor {- border-bottom-left-radius: 10px;- border-bottom-right-radius: 10px;+ border-bottom-left-radius: 9px;+ border-bottom-right-radius: 9px;}:root {@@ -312,7 +312,6 @@.Cell:focus-within .cm-editor {box-shadow: none;border: 1px solid transparent;- border-radius: 0;}.Cell.published {diff --git a/frontend/src/css/globals.css b/frontend/src/css/globals.cssindex 81a8fe8329..73261e10c9 100644--- a/frontend/src/css/globals.css+++ b/frontend/src/css/globals.css@@ -104,7 +104,7 @@--popover: 151 5.5% 15.2%; /* sage-3 */--popover-foreground: 155 5% 68.3%; /* sage-11 */--card: 151 5.5% 15.2%; /* sage-3 */- --card-foreground: 155 5% 68.3%; /* sage-11 */+ --card-foreground: 155 5% 76.3%; /* sage-11, modified */--border: 153 3.7% 24.2%; /* sage-6 */--input: 154 3.3% 28.7%; /* sage-7 */--primary: 192 59.8% 39%; /* cyan-8 */@@ -115,6 +115,47 @@--destructive-foreground: 210 40% 98%; /* red-1 */--accent: 192 56.6% 26.5%; /* cyan-7 */--accent-foreground: 190 80% 84%; /* cyan-12 */++ --link: 211 90% 62% /* blue-11 */;+ --link-visited: 272 51% 74% /* purple-9 */;++ /* Base shadows. */+ --base-shadow: hsl(0deg 0% 15% / 60%);+ --base-shadow-darker: hsl(0deg 0% 50% / 60%);++ /* Fuzzy shadows. */+ --shadow-xxs: 0px 0px 2px 0px var(--base-shadow-darker);+ --shadow-xs: 1px 1px 2px 0px var(--base-shadow),+ 0px 0px 2px 0px hsl(0deg 0% 75% / 50%);+ --shadow-sm: 2px 2px 2px 0px var(--base-shadow),+ 0px 0px 2px 0px hsl(0deg 0% 75% / 50%);+ --shadow-md: 4px 4px 4px 0px var(--base-shadow),+ 0 0px 4px 0px hsl(0deg 0% 40% / 50%);+ --shadow-lg: 5px 6px 4px 0px var(--base-shadow),+ 0 0px 4px 0px hsl(0deg 0% 25% / 50%);+ --shadow-xl: 8px 9px 4px 0px var(--base-shadow),+ 0 0px 6px 0px hsl(0deg 0% 15% / 50%);++ /* Shadow states. */+ --stale-color: hsl(42deg 56% 44% / 75%);+ --light-shadow: 2px 2px 0px 0px var(--base-shadow),+ 0px 0px 2px 0px hsl(0deg 0% 75% / 50%);+ --light-shadow-stale: 4px 4px 0px 0px var(--stale-color),+ 0px 0px 4px 0px var(--stale-color);+ --medium-shadow: 4px 4px 0px 0px var(--base-shadow),+ 0px 0px 4px 0px hsl(0deg 0% 100% / 50%);+ --medium-shadow-stale: 6px 6px 0px 0px var(--stale-color),+ 0px 0px 4px 0px var(--stale-color);+ --light-shadow-error: 4px 4px 0px 0px var(--red-5),+ 0px 0px 2px 0px var(--red-5);+ --medium-shadow-error: 6px 6px 0px 0px var(--red-5),+ 0px 0px 2px 0px var(--red-5);+ --heavy-shadow: 5px 6px 0px 0px var(--base-shadow),+ 0px 0px 4px 0px hsl(0deg 0% 100% / 50%);+ --heavy-shadow-stale: 7px 8px 0px 0px var(--stale-color),+ 0px 0px 4px 0px var(--stale-color);+ --heavy-shadow-error: 7px 8px 0px 0px var(--red-5),+ 0px 0px 2px 0px var(--red-5);}}diff --git a/frontend/src/editor/cell/TinyCode.tsx b/frontend/src/editor/cell/TinyCode.tsxindex ea75c04908..141bb0c087 100644--- a/frontend/src/editor/cell/TinyCode.tsx+++ b/frontend/src/editor/cell/TinyCode.tsx@@ -8,7 +8,7 @@ interface Props {export const TinyCode: React.FC<Props> = ({ code }) => {return (<div- className="text-gray-500 flex flex-col overflow-hidden"+ className="text-muted-foreground flex flex-col overflow-hidden"style={{fontSize: "8px",lineHeight: "10px",diff --git a/frontend/src/editor/links/cell-link.tsx b/frontend/src/editor/links/cell-link.tsxindex 58279906c9..b6187b14c8 100644--- a/frontend/src/editor/links/cell-link.tsx+++ b/frontend/src/editor/links/cell-link.tsx@@ -17,7 +17,7 @@ export const CellLink = (props: Props): JSX.Element => {return (<divclassName={cn(- "inline-block cursor-pointer text-blue-500 hover:underline",+ "inline-block cursor-pointer text-[var(--blue-10)] hover:underline",className)}onClick={(e) => {diff --git a/frontend/src/editor/output/JsonOutput.tsx b/frontend/src/editor/output/JsonOutput.tsxindex e30571c3bf..6079c3fc70 100644--- a/frontend/src/editor/output/JsonOutput.tsx+++ b/frontend/src/editor/output/JsonOutput.tsx@@ -7,7 +7,7 @@ import { ImageOutput } from "./ImageOutput";import { TextOutput } from "./TextOutput";import { VideoOutput } from "./VideoOutput";import { logNever } from "../../utils/assertNever";-import { useTheme } from "../../theme/useTheme";+import { useThemeForPlugin } from "../../theme/useTheme";interface Props {/**@@ -30,7 +30,7 @@ interface Props {*/export const JsonOutput: React.FC<Props> = memo(({ data, format = "auto", name = false, className }) => {- const { theme } = useTheme();+ const { theme } = useThemeForPlugin();if (format === "auto") {format = inferBestFormat(data);}diff --git a/frontend/src/editor/renderers/grid-layout/grid-layout.tsx b/frontend/src/editor/renderers/grid-layout/grid-layout.tsxindex 8b11b8da42..4721ef0d13 100644--- a/frontend/src/editor/renderers/grid-layout/grid-layout.tsx+++ b/frontend/src/editor/renderers/grid-layout/grid-layout.tsx@@ -254,7 +254,7 @@ const GridLayoutRenderer: React.FC<Props> = ({});e.dataTransfer.setData("text/plain", "");}}- className="droppable-element bg-white border-border border overflow-hidden p-2 rounded flex-shrink-0"+ className="droppable-element bg-background border-border border overflow-hidden p-2 rounded flex-shrink-0"><GridCellcode={cell.code}diff --git a/frontend/src/editor/renderers/grid-layout/styles.css b/frontend/src/editor/renderers/grid-layout/styles.cssindex e4202645a9..2e6df756f9 100644--- a/frontend/src/editor/renderers/grid-layout/styles.css+++ b/frontend/src/editor/renderers/grid-layout/styles.css@@ -10,6 +10,11 @@visibility: visible;}+.dark .react-grid-item > .react-resizable-handle::after {+ border-right: 2px solid rgba(255, 255, 255, 0.5);+ border-bottom: 2px solid rgba(255, 255, 255, 0.5);+}+.disable-animation .react-grid-item {transition-property: none !important;transition: none !important;diff --git a/frontend/src/editor/renderers/layout-select.tsx b/frontend/src/editor/renderers/layout-select.tsxindex c3920ad417..e0e6bd07f5 100644--- a/frontend/src/editor/renderers/layout-select.tsx+++ b/frontend/src/editor/renderers/layout-select.tsx@@ -29,7 +29,7 @@ export const LayoutSelect: React.FC = () => {onValueChange={(v) => setLayoutType(v as LayoutType)}><SelectTrigger- className="min-w-[110px] border-border"+ className="min-w-[110px] border-border bg-background"data-testid="layout-select"><SelectValue placeholder="Select a view" />diff --git a/frontend/src/plugins/core/registerReactComponent.tsx b/frontend/src/plugins/core/registerReactComponent.tsxindex 0cfd56eaa5..21c4a6177d 100644--- a/frontend/src/plugins/core/registerReactComponent.tsx+++ b/frontend/src/plugins/core/registerReactComponent.tsx@@ -32,7 +32,7 @@ import { renderError } from "./BadPlugin";import { renderHTML } from "./RenderHTML";import { invariant } from "../../utils/invariant";import { Logger } from "../../utils/Logger";-import { getTheme } from "@/theme/useTheme";+import { useThemeForPlugin } from "@/theme/useTheme";import { FUNCTIONS_REGISTRY } from "@/core/functions/FunctionRegistry";import { getUIElementObjectId } from "@/core/dom/UIElement";import { PluginFunctions } from "./rpc";@@ -65,6 +65,7 @@ function PluginSlotInternal<T>(): JSX.Element {const [childNodes, setChildNodes] = useState<ReactNode>(children);const [value, setValue] = useState<T>(getInitialValue());+ const { theme } = useThemeForPlugin();const [parseResult, setParseResult] = useState(() => {return plugin.validator.safeParse({@@ -198,7 +199,6 @@ function PluginSlotInternal<T>(}// Render the plugin- const theme = getTheme();return (<div className={`contents ${theme}`}>{plugin.render({diff --git a/frontend/src/plugins/impl/vega/VegaPlugin.tsx b/frontend/src/plugins/impl/vega/VegaPlugin.tsxindex 5d947d71f1..0b4e20e22f 100644--- a/frontend/src/plugins/impl/vega/VegaPlugin.tsx+++ b/frontend/src/plugins/impl/vega/VegaPlugin.tsx@@ -19,6 +19,7 @@ import { useAsyncData } from "@/hooks/useAsyncData";import { fixRelativeUrl } from "./fix-relative-url";import "./vega.css";+import { useThemeForPlugin } from "@/theme/useTheme";interface Data {spec: VegaLiteSpec;@@ -132,6 +133,7 @@ const LoadedVegaComponent = ({fieldSelection,spec,}: VegaComponentProps<T>): JSX.Element => {+ const { theme } = useThemeForPlugin();const vegaView = useRef<View>();const [error, setError] = useState<Error>();@@ -202,6 +204,7 @@ const LoadedVegaComponent = ({)}<VegaLitespec={selectableSpec}+ theme={theme === "dark" ? "dark" : undefined}actions={actions}signalListeners={signalListeners}onError={handleError}diff --git a/frontend/src/plugins/impl/vega/vega.css b/frontend/src/plugins/impl/vega/vega.cssindex bb92672936..c8e87e71d2 100644--- a/frontend/src/plugins/impl/vega/vega.css+++ b/frontend/src/plugins/impl/vega/vega.css@@ -11,3 +11,7 @@ div:has(> marimo-ui-element > marimo-vega) {flex: 1;min-width: 450px;}++.vega-embed canvas {+ @apply rounded-md;+}diff --git a/frontend/src/plugins/layout/StatPlugin.tsx b/frontend/src/plugins/layout/StatPlugin.tsxindex c4fea4a39e..519361d100 100644--- a/frontend/src/plugins/layout/StatPlugin.tsx+++ b/frontend/src/plugins/layout/StatPlugin.tsx@@ -39,8 +39,8 @@ export const StatComponent: React.FC<Data> = ({return (<divclassName={cn(- "text-card-foreground bg-card",- bordered && "rounded-xl border shadow"+ "text-card-foreground",+ bordered && "rounded-xl border shadow bg-card")}>{label && (diff --git a/frontend/src/stories/checkbox.stories.mdx b/frontend/src/stories/checkbox.stories.mdxindex 690a40bcc7..5e90681da9 100644--- a/frontend/src/stories/checkbox.stories.mdx+++ b/frontend/src/stories/checkbox.stories.mdx@@ -16,7 +16,7 @@ import { Checkbox } from "@/components/ui/checkbox";>Accept terms and conditions</label>- <p className="text-sm text-slate-500 dark:text-slate-400">+ <p className="text-sm text-muted-foreground">You agree to our Terms of Service and Privacy Policy.</p></div>diff --git a/frontend/src/stories/input.stories.mdx b/frontend/src/stories/input.stories.mdxindex 860ad194b9..6ca6647863 100644--- a/frontend/src/stories/input.stories.mdx+++ b/frontend/src/stories/input.stories.mdx@@ -27,7 +27,7 @@ import { Button } from "@/components/ui/button";<div className="grid w-full max-w-sm items-center gap-1.5"><Label htmlFor="email-2">Email</Label><Input type="email" id="email-2" placeholder="Email" />- <p className="text-sm text-slate-500">Enter your email address.</p>+ <p className="text-sm text-muted-foreground">Enter your email address.</p></div></Story>diff --git a/frontend/src/stories/popover.stories.mdx b/frontend/src/stories/popover.stories.mdxindex 00ca8c4db7..d0e57b6cfa 100644--- a/frontend/src/stories/popover.stories.mdx+++ b/frontend/src/stories/popover.stories.mdx@@ -26,7 +26,7 @@ import {<div className="grid gap-4"><div className="space-y-2"><h4 className="font-medium leading-none">Dimensions</h4>- <p className="text-sm text-slate-500 dark:text-slate-400">+ <p className="text-sm text-muted-foreground">Set the dimensions for the cell output.</p></div>diff --git a/frontend/src/stories/tabs.stories.mdx b/frontend/src/stories/tabs.stories.mdxindex 029cc8ce35..48c5ef7935 100644--- a/frontend/src/stories/tabs.stories.mdx+++ b/frontend/src/stories/tabs.stories.mdx@@ -15,7 +15,7 @@ import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";<TabsTrigger value="variables">Variables</TabsTrigger></TabsList><TabsContent value="config">- <p className="text-sm text-slate-500 dark:text-slate-400">+ <p className="text-sm text-muted-foreground">Change your account settings here.</p><div className="grid gap-2 py-4">@@ -33,9 +33,7 @@ import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";</div></TabsContent><TabsContent value="variables">- <p className="text-sm text-slate-500 dark:text-slate-400">- Change your variables here.- </p>+ <p className="text-sm text-muted-foreground">Change your variables here.</p><div className="grid gap-2 py-4"><div className="space-y-1"><Label htmlFor="env1">ENV 1</Label>diff --git a/frontend/src/stories/textarea.stories.mdx b/frontend/src/stories/textarea.stories.mdxindex 3ccaae3a86..4946077e8c 100644--- a/frontend/src/stories/textarea.stories.mdx+++ b/frontend/src/stories/textarea.stories.mdx@@ -27,7 +27,7 @@ import { Button } from "@/components/ui/button";<div className="grid w-full gap-1.5"><Label htmlFor="message-2">Your Message</Label><Textarea placeholder="Type your message here." id="message-2" />- <p className="text-sm text-slate-500">+ <p className="text-sm text-muted-foreground">Your message will be copied to the support team.</p></div>diff --git a/frontend/src/theme/useTheme.ts b/frontend/src/theme/useTheme.tsindex fc1d31dd80..3cb769c1b2 100644--- a/frontend/src/theme/useTheme.ts+++ b/frontend/src/theme/useTheme.ts@@ -5,6 +5,7 @@ import { useAtom } from "jotai";import Cookies from "js-cookie";import { atomWithStorage } from "jotai/utils";import { SyncStorage } from "jotai/vanilla/utils/atomWithStorage";+import { useEffect, useState } from "react";export type Theme = "light" | "dark";@@ -55,3 +56,18 @@ export function getTheme(): Theme {}return "light";}++/**+ * Plugins are in a different react tree, so we cannot use useAtom as it looks+ * for an existing Provider. Instead we need to subscribe to the atom directly.+ */+export function useThemeForPlugin() {+ const [theme, setTheme] = useState(getTheme());+ useEffect(() => {+ return store.sub(themeAtom, () => {+ setTheme(getTheme());+ });+ }, []);++ return { theme };+}