diff --git a/client/modules/IDE/components/Editor.js b/client/modules/IDE/components/Editor.js index d035a104..ae8c415b 100644 --- a/client/modules/IDE/components/Editor.js +++ b/client/modules/IDE/components/Editor.js @@ -37,7 +37,7 @@ class Editor extends React.Component { componentDidMount() { this.beep = new Audio(beepUrl); this._cm = CodeMirror(this.refs.container, { // eslint-disable-line - theme: 'p5-widget', + theme: `p5-${this.props.theme}`, value: this.props.file.content, lineNumbers: true, styleActiveLine: true, @@ -106,6 +106,10 @@ class Editor extends React.Component { this._cm.setOption('mode', 'htmlmixed'); } } + + if (this.props.theme !== prevProps.theme) { + this._cm.setOption('theme', `p5-${this.props.theme}`); + } } componentWillUnmount() { @@ -191,7 +195,8 @@ Editor.propTypes = { showEditorOptions: PropTypes.func.isRequired, closeEditorOptions: PropTypes.func.isRequired, showKeyboardShortcutModal: PropTypes.func.isRequired, - setUnsavedChanges: PropTypes.func.isRequired + setUnsavedChanges: PropTypes.func.isRequired, + theme: PropTypes.string.isRequired, }; export default Editor; diff --git a/client/modules/IDE/pages/IDEView.js b/client/modules/IDE/pages/IDEView.js index 3f1eaaf3..d989a015 100644 --- a/client/modules/IDE/pages/IDEView.js +++ b/client/modules/IDE/pages/IDEView.js @@ -274,6 +274,7 @@ class IDEView extends React.Component { closeEditorOptions={this.props.closeEditorOptions} showKeyboardShortcutModal={this.props.showKeyboardShortcutModal} setUnsavedChanges={this.props.setUnsavedChanges} + theme={this.props.preferences.theme} />