Jsoneditor: how to programmablely change header color

Created on 8 Jul 2020  路  6Comments  路  Source: josdejong/jsoneditor

Yes, you can simply override the color with your own CSS. Just open your developer console and have a look at the class names used for background and border colors, and override it with your own color schema.

_Originally posted by @josdejong in https://github.com/josdejong/jsoneditor/issues/879#issuecomment-571960194_

question

Most helpful comment

What you can do is give the containers where you attach the JSONEditors different classes:

<div class="editor1"></div>
<div class="editor2"></div>

then create different styling for the different containers:

div.editor1 div.jsoneditor-menu {
  background-color: red;
}

div.editor2 div.jsoneditor-menu {
  background-color: blue;
}

All 6 comments

I need programmable change color, for example:

   `       jsoneditor.option = {

     header: black
     border:  red

  }

`

`.jsoneditor .value[style*="color: green;"] {
color: lime !important;
}

.jsoneditor .value[style*="color: red;"] {
color: rgb(75, 193, 255) !important;
}`

But I can't find document talk about this, only some issue talk about color change by update css.

How to do it programmablely?

   `        
      var options = {
        header-color : 'yellow',
        theme: 'dark',


      };

`

Can we set options to change color when initialize json-editor?

dynamic create css and apply is not what I want.

I want create 2 json-editor with different color at the same time.

One json-editor header is blue (default) color

secon json-editor header is green color

Both editor show on same page side by side, just like your demo

Can you make your demon 2 editor with 2 different header color?

What you can do is give the containers where you attach the JSONEditors different classes:

<div class="editor1"></div>
<div class="editor2"></div>

then create different styling for the different containers:

div.editor1 div.jsoneditor-menu {
  background-color: red;
}

div.editor2 div.jsoneditor-menu {
  background-color: blue;
}

@josdejong it perfectly fit my need. works great !

I customize , selector by id
jsoneditor_list , jsoneditor_info_list

image

This is result:

same page, with 2 tab, each tab has different color

first tab
image

second tab
image

Was this page helpful?
0 / 5 - 0 ratings

Related issues

maiscourt picture maiscourt  路  5Comments

azakordonets picture azakordonets  路  6Comments

realtebo picture realtebo  路  3Comments

ricardogaspar2 picture ricardogaspar2  路  3Comments

cope picture cope  路  8Comments