package style does behave inconsistent

0 votes
asked Mar 10, 2024 in Question / help by jlo2k (160 points)
edited Mar 12, 2024 by jlo2k

Hello,

maybe due to uncomplete documentation i may just misunderstand but i witnessed the following around packages:

skinparam package Rectangle seem to work in simpler setups.

But i followed some hints that you could change the skinparam and the packages would then use the style set at definition time. It seems that is not the case. I found the last packageStyle skinparam defines all packages styles in the diagram definition.

Code i found somewhere that result in two folder style packages:

@startuml
' Setting PackageStyle
skinparam PackageStyle rectangle

' Define a package using the rect style
package "Rect Style Package" {
    class MyClass {
        -attribute : int
        +method() : void
    }
}

' Change PackageStyle for subsequent packages
skinparam PackageStyle folder

' Define another package using the folder style
package "Folder Style Package" {
    class AnotherClass {
        -attribute : string
        +method() : void
    }
}
@enduml

So if you want different package styles in your diagram, the only way would be to use a package stereotype and a specific skinparam section for that stereotype.
I found this does not work at all:

@startuml
'this style is applied to all packages
skinparam packageStyle rectangle

package "Design" <<Design Domain>> {
   class "My Class"
}

skinparam package<<Design Domain>> {
   BorderThickness 5     'works
   BorderColor #679cae   'works
   Style rectangle
   'This Style is ignored if the first one is commented out, but color and thickness are applied
}

@enduml

Can someone help me to figure out what the current implementation should provide and if that is according to the requirements or should i open a bug?

1 Answer

0 votes
answered Mar 7, 2025 by dickmaley (4,160 points)

This works

image

@startuml
<style>
package{
  package {
    BackgroundColor: #white/Aqua;
    FontColor: Blue;
    FontSize: 14;
    FontStyle: Bold;
    LineColor: Blue;
    LineThickness: 3;
    RoundCorner: 30;
    'Shadowing: 3.0;  
    Shadowing: 5;
  }  
}
</style>

package "Design"  {
   class "My Class"
}
@enduml

...