fix: nano-repl highlighting

This commit is contained in:
Felix Roos 2023-03-02 14:47:15 +01:00
parent db4d0f26a8
commit efddbb616b
3 changed files with 31 additions and 5 deletions

View File

@ -66,7 +66,7 @@ function App() {
const [code, setCode] = useState(defaultTune); const [code, setCode] = useState(defaultTune);
const [view, setView] = useState(); const [view, setView] = useState();
// const [code, setCode] = useState(`"c3".note().slow(2)`); // const [code, setCode] = useState(`"c3".note().slow(2)`);
const { scheduler, evaluate, schedulerError, evalError, isDirty, activeCode, pattern } = useStrudel({ const { scheduler, evaluate, schedulerError, evalError, isDirty, activeCode, pattern, started } = useStrudel({
code, code,
defaultOutput: webaudioOutput, defaultOutput: webaudioOutput,
getTime, getTime,
@ -75,8 +75,8 @@ function App() {
useHighlighting({ useHighlighting({
view, view,
pattern, pattern,
active: !activeCode?.includes('strudel disable-highlighting'), active: started && !activeCode?.includes('strudel disable-highlighting'),
getTime: () => scheduler.getPhase(), getTime: () => scheduler.now(),
}); });
const error = evalError || schedulerError; const error = evalError || schedulerError;

View File

@ -2,6 +2,18 @@
@tailwind components; @tailwind components;
@tailwind utilities; @tailwind utilities;
:root {
--background: #222;
--lineBackground: #22222250;
--foreground: #fff;
--caret: #ffcc00;
--selection: rgba(128, 203, 196, 0.5);
--selectionMatch: #036dd626;
--lineHighlight: #00000050;
--gutterBackground: transparent;
--gutterForeground: #8a919966;
}
body { body {
background: #123; background: #123;
} }

View File

@ -6,9 +6,23 @@ This program is free software: you can redistribute it and/or modify it under th
module.exports = { module.exports = {
// TODO: find out if leaving out tutorial path works now // TODO: find out if leaving out tutorial path works now
content: ['./src/**/*.{js,jsx,ts,tsx}'], content: ['./src/**/*.{js,jsx,ts,tsx}', '../../src/**/*.{html,js,jsx,md,mdx,ts,tsx}'],
theme: { theme: {
extend: {}, extend: {
colors: {
// codemirror-theme settings
background: 'var(--background)',
lineBackground: 'var(--lineBackground)',
foreground: 'var(--foreground)',
caret: 'var(--caret)',
selection: 'var(--selection)',
selectionMatch: 'var(--selectionMatch)',
gutterBackground: 'var(--gutterBackground)',
gutterForeground: 'var(--gutterForeground)',
gutterBorder: 'var(--gutterBorder)',
lineHighlight: 'var(--lineHighlight)',
},
},
}, },
plugins: [], plugins: [],
}; };