【发布时间】:2020-04-29 21:25:21
【问题描述】:
我正在寻找更改 monaco 编辑器的背景颜色。我在 React 中使用以下 monaco npm 包:Monaco React
有没有办法在下面的编辑器组件中做到这一点?我在下面的选项对象完美地工作,所以希望对编辑器背景颜色做类似的事情。
我应该为此使用defineTheme function 吗?
这是我正在尝试使用的编辑器代码:
<Editor
height="90vh"
width="870px"
language="javascript"
line="2"
options={{
minimap: {
enabled: false,
},
fontSize: 18,
cursorStyle: "block",
wordWrap: "on",
}}
defineTheme={{
themeName: "my-theme",
themeData: {
colors: {
"editor.background": "#000000",
},
},
}}
value={"// write your code here"}
editorDidMount={handleEditorDidMount}
/>
【问题讨论】:
-
根据props docs 看来
theme只需要light|dark的枚举字符串。
标签: reactjs monaco-editor