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.

Add light/dark/system settings from command palette (#5444)

vincent d warmerdam3d96e17c768f
diff --git a/frontend/src/components/editor/actions/useConfigActions.tsx b/frontend/src/components/editor/actions/useConfigActions.tsx
index acc0c2195b..509963837e 100644
--- a/frontend/src/components/editor/actions/useConfigActions.tsx
+++ b/frontend/src/components/editor/actions/useConfigActions.tsx
@@ -4,11 +4,9 @@ import { useAppConfig, useResolvedMarimoConfig } from "@/core/config/config";
import type { AppConfig, UserConfig } from "@/core/config/config-schema";
import { getAppWidths } from "@/core/config/widths";
import { saveAppConfig, saveUserConfig } from "@/core/network/requests";
-import { useTheme } from "@/theme/useTheme";
import type { ActionButton } from "./types";
export function useConfigActions() {
- const { theme } = useTheme();
const [config, setConfig] = useResolvedMarimoConfig();
const [appConfig, setAppConfig] = useAppConfig();
@@ -37,15 +35,37 @@ export function useConfigActions() {
},
})),
{
- label: "Config > Toggle dark mode",
+ label: "Config > Set theme: dark",
handle: () => {
handleUserConfig({
...config,
display: {
- // We don't use the config from the setting since
- // we want to resolve 'system' to it's current value.
...config.display,
- theme: theme === "dark" ? "light" : "dark",
+ theme: "dark",
+ },
+ });
+ },
+ },
+ {
+ label: "Config > Set theme: light",
+ handle: () => {
+ handleUserConfig({
+ ...config,
+ display: {
+ ...config.display,
+ theme: "light",
+ },
+ });
+ },
+ },
+ {
+ label: "Config > Set theme: system",
+ handle: () => {
+ handleUserConfig({
+ ...config,
+ display: {
+ ...config.display,
+ theme: "system",
},
});
},