bschwarz / puml-themes

This repository is used to hold themes for plantuml (www.plantuml.com) diagraming tool. Users can use these themes to give there diagrams different looks.
MIT License
259 stars 68 forks source link

Collections won't display text #5

Open shreyharia opened 4 years ago

shreyharia commented 4 years ago

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
bschwarz commented 4 years ago

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

shreyharia commented 4 years ago

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 commented 4 years ago

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
bschwarz commented 4 years ago

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