Search code examples
ace-editoralloy-ui

AlloyUI Ace-Editor Theme Change


I am not able to find a way to change the Ace-Editor that is built into the AllouUI widget. The example below is what I would like to achieve with the theme attribute.

YUI().use( 'aui-ace-autocomplete-base', function(Y) { var editor = new Y.AceEditor( { boundingBox: '#myEditor', height: '200', mode: 'python', value: 'print("Hello there!!!")', width: '700', theme: 'chaos' } ).render(); Sadly, there in the code there are no predefined ways I saw to change the theme.

Is there a way change the theme to ace editor for alloyui's widget?


Solution

  • Not sure if Y.AceEditor component exposes the required api, but you can try to get the real ace editor object, which allows to change the theme dynamically

    document.getElementById('#myEditor').env.editor.setTheme("ace/theme/chtome")