Background color partial transparency/opacity support

0 votes
asked Apr 16, 2020 in Wanted features by GitNick (160 points)
edited Apr 16, 2020 by GitNick

I would like to be able to create semi-transparent backgrounds for groups. Is there a way to do that? My output is SVG. If instead of putting 52ecd9, normally in SVG/web, I would just use two additional hex characters to also set opacity, 52ecd988. Looking at the output, I see it just gets replaced with FFFFFF

Right now SequenceGroupBodyBackgroundColor can be either a color:

Or transparent

In between would be preferable so you could still see the box outline subtly under a group:

@startuml
skinparam SequenceGroupBodyBackgroundColor 55555555 ' <--------- the last two characters would normally indicate a level of transparency between 00 and FF

participant client
box
  participant server
end box

opt
client -> server : hello

  opt
    client -> server : hello
  end opt

end opt
@enduml

2 Answers

0 votes
answered Apr 16, 2020 by plantuml (257,900 points)
Right now, I must say that transparent is not well managed by PlantUML...

So maybe, it's time for us to better handle transparent/opacity now :-)

To start, could you post a very basic example (so a very simple text diagram, with a single group) of what you are expecting ? We could then use this first example for discussion. Thanks !
commented Apr 16, 2020 by GitNick (160 points)
I've modified the original question with examples.

Thanks for such a great tool BTW!
0 votes
answered Apr 21, 2020 by plantuml (257,900 points)

It's really a first draft, but we have changed things...

So now in last beta http://beta.plantuml.net/plantuml.jar , you can have :

@startuml
skinparam shadowing false
skinparam SequenceGroupBodyBackgroundColor 55555555

participant client
box
  participant server
end box

opt
client -> server : hello

  opt
    client -> server : hello
  end opt

end opt
@enduml

Few points :

  • Opacity is ignored (right now) in PNG export. Not sure if this will be ever added in the future
  • Shadows will probably never work with opacity settings. Right now, you have to manually disable shadowing
  • We litterally did no test at all, so your feedback is welcome :-)
commented Apr 21, 2020 by GitNick (160 points)

Wow! You're on the ball!

I just tried it. And while it no longer just ignores the value, it appears to be merely truncating the first two digits. 

So a value of 40444455 becomes 444455

commented Apr 21, 2020 by GitNick (160 points)
Oh, and as for PNG export, I prefer SVG most of the time. And when I do need PNG, I just convert the SVG anyways.
commented May 5, 2020 by The-Lu (31,160 points)

Waouh!
That's marvelous.

Opacity in PNG:

>Shadows will probably never work with opacity settings. Right now, you have to manually disable shadowing

Awaiting now the shadowing management ;)

Good job,
Thanks for this opacity management,
Regards,
Th.

asked May 28, 2020 in Wanted features by The-Lu (31,160 points)
edited May 28, 2020 by The-Lu
Full opacity (alpha compositing) support (for SVG and PNG)
...