puml-themes icon indicating copy to clipboard operation
puml-themes copied to clipboard

Collections won't display text

Open shreyharia opened this issue 4 years ago • 4 comments

Collections inside a package won't display text in it.

Code to reproduce:

@startuml
!include https://raw.githubusercontent.com/bschwarz/puml-themes/master/themes/cerulean/puml-theme-cerulean.puml

package World {
  collections Hellos as "Hellos"
}

@enduml

Expected: "Hellos" text within the collections Actual:

Screen Shot 2020-07-22 at 12 09 45 PM

shreyharia avatar Jul 22 '20 18:07 shreyharia

For some reason, the background color is not getting properly set, and the FontColor is white, so you won't see the text on a white background. I think there is a bug in plantuml. If you just do collections on its own:

@startuml
!include https://raw.githubusercontent.com/bschwarz/puml-themes/master/themes/cerulean/puml-theme-cerulean.puml

collections Hellos as "Hellos"

@enduml

it works. But as soon as you introduce "package", it doesn't work. I tried to add a skinparam and as well, but those don't work if the collections is within a package. So, I don't think there is anything I can do, since I think this is with plantuml.

The only thing that seemed to help, is if you change the background color of the package, so that the white text shows up in the collections:

@startuml
!include https://raw.githubusercontent.com/bschwarz/puml-themes/master/themes/cerulean/puml-theme-cerulean.puml

skinparam package {
BackgroundColor lightgray
}

package World {
  collections Hellos as "Hellos"
}
@enduml

Sorry I couldn't help more. Cheers, Brett

bschwarz avatar Jul 24 '20 16:07 bschwarz

Thanks Brett,

Other themes (as given below) seems to work somehow. Probably it is not plantUML then?

@startuml
!include https://raw.githubusercontent.com/bschwarz/puml-themes/master/themes/cerulean-outline/puml-theme-cerulean-outline.puml

package World {
  collections Hellos as "Hellos"
}

@enduml

Best, Shrey

shreyharia avatar Jul 30 '20 18:07 shreyharia

On a similar note - even rectangle (as given below) doesn't seem to work:

@startuml
!include https://raw.githubusercontent.com/bschwarz/puml-themes/master/themes/cerulean/puml-theme-cerulean.puml

rectangle Hello as "Hello!"

@enduml

shreyharia avatar Jul 30 '20 18:07 shreyharia

The reason those other themes work is because of the font color for those themes. The "collections" are really meant for sequence diagrams. So, if you look at the puml-themes example for sequence diagrams, the collections are rendered properly (look at "Foo6" in the sequence diagram here ). Notice the background is blue in for the collections in the sequence diagram, and the font is white. However, when the collections are used outside of sequence diagrams, for some reason the background does not get set properly, so you have a background (white) as the same color as the font color (white).

So, I think that is a problem with plantuml. Or maybe collections are allowed outside of sequence diagrams, I'm not sure.

For the rectangle, yes I think that is a bug in puml-themes...the font color is getting set incorrectly. I will fix that. If you need a fix right now for "rectangle", you can add a skinparam after the !include https:// .... line at the top. So, it would look like this:

@startuml

!include https://raw.githubusercontent.com/bschwarz/puml-themes/master/themes/cerulean/puml-theme-cerulean.puml
  skinparam rectangle {
    FontColor $PRIMARY
  }

rectangle Hello as "Hello!"

@enduml

I should have a fix for rectangle this weekend.

Cheers, Brett

bschwarz avatar Aug 02 '20 04:08 bschwarz