How do we use themes Like monokai? #201
Answered
by
ItsMeStevieG
ItsMeStevieG
asked this question in
Q&A
|
could you please provide an example for monokai or monokai bright? |
Answered by
ItsMeStevieG
Mar 6, 2021
Replies: 1 comment
|
Managed to work it out myself by doing the following: npm install monaco-themesthen import Editor, { DiffEditor, useMonaco, loader } from "@monaco-editor/react";
import "monaco-themes/themes/Monokai Bright.json";
function App() {
const monaco = useMonaco();
useEffect(() => {
if (monaco) {
console.log("here is the monaco isntance:", monaco);
import('monaco-themes/themes/Monokai Bright.json')
.then(data => {
monaco.editor.defineTheme('monokai-bright', data);
})
.then(_ => monaco.editor.setTheme('monokai-bright'))
// monaco.editor.defineTheme("monokai-bright").then(_ => monaco.editor.setMonacoTheme("monokai-bright"));
}
}, [monaco]);
... |
0 replies
Answer selected by
ItsMeStevieG
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Managed to work it out myself by doing the following:
then