Timing diagram - How can I assign different colors to single participants?

0 votes
asked Apr 20 in Question / help by anonymous
I would like to improve the readability of a timing diagram by assigning different colors to distinct line signals.
For example making a group of binary signals in green (as "input signals") and others in red ("output signals").

Is there a syntax that allows me to set these attributes?

Thank you in advance!

1 Answer

0 votes
answered Apr 20 by The-Lu (45,820 points)

Hello A.,

Unfortunately, it is not yet implemented; because `style` on `timing` is nowadays only global not yet local...

See:

Here are some proposals:

@startuml
<style>
timingDiagram {
  binary {
    LineColor green
  }
}
</style>
clock clk with period 1
binary "Input Signal 1"  as IS1
binary "Input Signal 2"  as IS2
binary "Output Signal 1" as OS1

@0
IS1 is low
IS2 is high
@5
IS1 is high
@6
IS2 is low
@10
IS1 is low

/' Output Signals '/
<style>
timingDiagram {
  binary {
    LineColor red
  }
}
</style>

@0
OS1 is low
@2
OS1 is high
@4
OS1 is low
@5
OS1 is high
@10
OS1 is low
@enduml

Or:

@startuml
<style>
timingDiagram {
  .red {
    LineColor red
  }
}
</style>
clock clk with period 1
binary "Input Signal 1"  as IS1
binary "Input Signal 2"  as IS2
binary "Output Signal 1" as OS1 <<red>>

@0
IS1 is low
IS2 is high
OS1 is low
@2
OS1 is high
@4
OS1 is low
@5
IS1 is high
OS1 is high
@6
IS2 is low
@10
IS1 is low
OS1 is low
@enduml

If that can help for a wanted feature... (for PlantUML team)
Regards.

commented May 4 by The-Lu (45,820 points)

This has been implemented in last release (V1.2022.5)

Thanks to PlantUML team...

commented May 5 by anonymous
Didn't expect to see it implemented so quickly! I will try it as soon as I can.

Thanks to both the PlantUML team and to you as well!

Kind regards
...