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

View File

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

View File

@ -21,6 +21,10 @@ const modes = {
* @constructor
*/
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 = {
isJSONEditor: true,