Skip to content

Commit b9d9a14

Browse files
committed
theming console iframe
1 parent 0f8f6bd commit b9d9a14

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/components/Editor/Runners/PythonRunner/PyodideRunner/PyodideRunner.jsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import VisualOutputPane from "./VisualOutputPane";
1818
import OutputViewToggle from "../OutputViewToggle";
1919
import { SettingsContext } from "../../../../../utils/settings";
2020
import RunnerControls from "../../../../RunButton/RunnerControls";
21+
import { useCookies } from "react-cookie";
2122
// import "prismjs/plugins/highlight-keywords/prism-highlight-keywords.js";
2223
// import Prism from "prismjs";
2324

@@ -69,6 +70,11 @@ const PyodideRunner = (props) => {
6970
const [inputStack, setInputStack] = useState([]);
7071
const [indentationLevel, setIndentationLevel] = useState(0);
7172
const [awaitingInput, setAwaitingInput] = useState(false);
73+
const [cookies] = useCookies(["theme"]);
74+
const defaultTheme = window.matchMedia("(prefers-color-scheme:dark)").matches
75+
? "dark"
76+
: "light";
77+
const theme = cookies.theme || defaultTheme;
7278

7379
const prependToInputStack = (input) => {
7480
setInputStack((prevInputStack) => {
@@ -482,7 +488,7 @@ const PyodideRunner = (props) => {
482488
<TabPanel key={1}>
483489
<iframe
484490
title="console"
485-
src="http://localhost:3012/en/embed/viewer/ipython-console?browserPreview=true&autoRun=true"
491+
src={`http://localhost:3012/en/embed/viewer/ipython-console?browserPreview=true&autoRun=true&theme=${theme}`}
486492
crossOrigin
487493
style={{ width: "100%", height: "100%" }}
488494
/>

0 commit comments

Comments
 (0)