Updated dark theme example

This commit is contained in:
jos 2016-10-28 12:14:47 +02:00
parent 9722414728
commit 4a12eed14f
3 changed files with 35 additions and 25 deletions

View File

@ -32,10 +32,11 @@
<script> <script>
// create the editor // create the editor
var container = document.getElementById('jsoneditor') var editor = jsoneditor(document.getElementById('jsoneditor'), {
var options = {
modes: ['text', 'tree'] modes: ['text', 'tree']
}; })
// load json
var json = { var json = {
'array': [1, 2, 3], 'array': [1, 2, 3],
'boolean': true, 'boolean': true,
@ -44,7 +45,7 @@
'object': {'a': 'b', 'c': 'd'}, 'object': {'a': 'b', 'c': 'd'},
'string': 'Hello World' 'string': 'Hello World'
} }
var editor = jsoneditor(container, options, json) editor.set(json)
</script> </script>
</body> </body>
</html> </html>

View File

@ -6,22 +6,31 @@ div.jsoneditor-menu {
div.jsoneditor-menu { div.jsoneditor-menu {
background-color: #4b4b4b; background-color: #4b4b4b;
} }
div.jsoneditor-tree, div.jsoneditor-tree-contents,
div.jsoneditor textarea.jsoneditor-text { textarea.jsoneditor-text {
background-color: #666666; background-color: #666666;
color: #ffffff; color: #ffffff;
} }
div.jsoneditor-field,
.jsoneditor-menu button.jsoneditor-undo:disabled {
background-position: -24px -96px;
}
.jsoneditor-menu button.jsoneditor-redo:disabled {
background-position: -48px -96px;
}
div.jsoneditor-property,
div.jsoneditor-value { div.jsoneditor-value {
color: #ffffff; color: #ffffff;
} }
table.jsoneditor-search div.jsoneditor-frame {
background: #808080; .jsoneditor-property:hover,
.jsoneditor-value:hover {
background-color: #808080;
} }
tr.jsoneditor-highlight, .jsoneditor-readonly:hover {
tr.jsoneditor-selected { background-color: transparent;
background-color: #808080;
} }
div.jsoneditor-field[contenteditable=true]:focus, div.jsoneditor-field[contenteditable=true]:focus,
@ -31,21 +40,17 @@ div.jsoneditor-value[contenteditable=true]:hover,
div.jsoneditor-field.jsoneditor-highlight, div.jsoneditor-field.jsoneditor-highlight,
div.jsoneditor-value.jsoneditor-highlight { div.jsoneditor-value.jsoneditor-highlight {
background-color: #808080; background-color: #808080;
border-color: #808080;
} }
div.jsoneditor-field.highlight-active, button.jsoneditor-button.jsoneditor-actionmenu {
div.jsoneditor-field.highlight-active:focus, background-position: -50px -50px;
div.jsoneditor-field.highlight-active:hover,
div.jsoneditor-value.highlight-active,
div.jsoneditor-value.highlight-active:focus,
div.jsoneditor-value.highlight-active:hover {
background-color: #b1b1b1;
border-color: #b1b1b1;
} }
div.jsoneditor-tree button:focus { button.jsoneditor-button:hover,
background-color: #868686; button.jsoneditor-button:focus,
button.jsoneditor-button:active {
background-color: #808080;
outline: #808080 solid 1px;
} }
/* coloring of JSON in tree mode */ /* coloring of JSON in tree mode */
@ -56,7 +61,7 @@ div.jsoneditor td.jsoneditor-separator {
color: #acacac; color: #acacac;
} }
div.jsoneditor-value.jsoneditor-string { div.jsoneditor-value.jsoneditor-string {
color: #00ff88; color: #8bb54b;
} }
div.jsoneditor-value.jsoneditor-object, div.jsoneditor-value.jsoneditor-object,
div.jsoneditor-value.jsoneditor-array { div.jsoneditor-value.jsoneditor-array {
@ -69,7 +74,7 @@ div.jsoneditor-value.jsoneditor-boolean {
color: #ff8048; color: #ff8048;
} }
div.jsoneditor-value.jsoneditor-null { div.jsoneditor-value.jsoneditor-null {
color: #49a7fc; color: #3B8EEA;
} }
div.jsoneditor-value.jsoneditor-invalid { div.jsoneditor-value.jsoneditor-invalid {
color: white; color: white;

View File

@ -21,6 +21,10 @@ const modes = {
* @constructor * @constructor
*/ */
function jsoneditor (container, options = {}) { function jsoneditor (container, options = {}) {
if (arguments.length > 2) {
throw new Error ('Passing JSON via the constructor has been deprecated. ' +
'Please pass JSON via editor.set(json).')
}
const editor = { const editor = {
isJSONEditor: true, isJSONEditor: true,