Can we use different backgroundcolor for highlight is jsonDiagram ?

0 votes
asked Jan 2, 2023 in Question / help by sk
Hi ,

I have json data

@startjson
 

 {
"task1":{
               "status":"success"

        },
"task2":{
               "status":"failed"

        }

}

@endjson

I want to use different background color to highlight like success status should be in green and failed status in red.

How i can do this?

2 Answers

+1 vote
answered Jan 2, 2023 by The-Lu (73,540 points)

Hello S., and all,

Awaiting stereotype or inline colour (on JSON or YAML):

Here is a possible workaround using creole:

@startjson
  {
"task1":{
               "status":"<back:green>success"
        },
"task2":{
               "status":"<back:red>failed"
        }
}
@endjson


It is not so pretty, but... enjoy...
Regards.

0 votes
answered Jan 11, 2023 by The-Lu (73,540 points)

Hello S., and all,

With the last version (V1.2023.0), we can now have:

@startjson
<style>
    .ok {
      BackGroundColor green
      FontColor white
      FontStyle italic
    }
    .ko {
      BackGroundColor red
      FontColor white
      FontStyle italic
    }
</style>
#highlight task1/status <<ok>>
#highlight task2/status <<ko>>

{
"task1":{
               "status":"success"
        },
"task2":{
               "status":"failed"
        }
}
@endjson

Thanks to PlantUML team. yes
Regards.

...