API Reference
This is the long list functions you can use! Remember that you don't need to remember all of those and that
diff --git a/website/src/repl/Repl.css b/website/src/repl/Repl.css
index 1ed44eaa..124fe4e4 100644
--- a/website/src/repl/Repl.css
+++ b/website/src/repl/Repl.css
@@ -10,10 +10,6 @@
opacity: 0.5;
}
-.cm-gutters {
- display: none !important;
-}
-
.cm-content {
padding-top: 12px !important;
padding-left: 8px !important;
@@ -22,3 +18,6 @@
.cm-scroller {
padding-bottom: 50vh;
}
+.cm-line > * {
+ background: var(--lineBackground);
+}
diff --git a/website/src/repl/Repl.jsx b/website/src/repl/Repl.jsx
index b26f2bbc..818adea9 100644
--- a/website/src/repl/Repl.jsx
+++ b/website/src/repl/Repl.jsx
@@ -5,7 +5,7 @@ This program is free software: you can redistribute it and/or modify it under th
*/
import { cleanupDraw, cleanupUi, controls, evalScope, getDrawContext, logger } from '@strudel.cycles/core';
-import { CodeMirror, cx, flash, useHighlighting, useStrudel } from '@strudel.cycles/react';
+import { CodeMirror, cx, flash, useHighlighting, useStrudel, useKeydown } from '@strudel.cycles/react';
import {
getAudioContext,
getLoadedSamples,
@@ -22,6 +22,10 @@ import { Header } from './Header';
import { prebake } from './prebake.mjs';
import * as tunes from './tunes.mjs';
import PlayCircleIcon from '@heroicons/react/20/solid/PlayCircleIcon';
+import { themes } from './themes.mjs';
+import useTheme from '../useTheme';
+
+const initialTheme = localStorage.getItem('strudel-theme') || 'strudelTheme';
initAudioOnFirstClick();
@@ -109,6 +113,7 @@ export const ReplContext = createContext(null);
export function Repl({ embedded = false }) {
const isEmbedded = embedded || window.location !== window.parent.location;
const [view, setView] = useState(); // codemirror view
+ const [theme, setTheme] = useState(initialTheme);
const [lastShared, setLastShared] = useState();
const [activeFooter, setActiveFooter] = useState('');
const [isZen, setIsZen] = useState(false);
@@ -167,12 +172,15 @@ export function Repl({ embedded = false }) {
),
);
+ const { settings } = useTheme();
+
// highlighting
useHighlighting({
view,
pattern,
active: started && !activeCode?.includes('strudel disable-highlighting'),
getTime: () => scheduler.now(),
+ color: settings?.foreground,
});
//
@@ -255,6 +263,8 @@ export function Repl({ embedded = false }) {
handleShare,
isZen,
setIsZen,
+ theme,
+ setTheme,
};
return (
// bg-gradient-to-t from-blue-900 to-slate-900
@@ -269,6 +279,7 @@ export function Repl({ embedded = false }) {
{error && (
-
{error.message || 'Unknown Error :-/'}
+
{error.message || 'Unknown Error :-/'}
)}
{isEmbedded && !started && (