Skinparam and hidden Stereotypes

0 votes
asked Nov 6, 2016 in Wanted features by rony76 (120 points)

Hi all, 

First off, thanks for this fabulous piece of software!

I wanted to create a component diagram styling different sets of components with different colors.
I was under the impression, by reading the Sprite and Skinparam paragraphs of the Component Diagram, that one could maybe use different styles based on stereotypes, but also that these stereotypes could be hidden by prefixing their name with a $ symbol.
So I tried something like this:

@startuml
skinparam component {
    BackgroundColor<<$base>> #99ff99
    BorderColor<<$base>> Black
    BackgroundColor<<example>> Yellow
    BorderColor<<example>> Maroon
}

package "Something" {
    [baseComponent1]<<$base>>
    [exampleComponent1]<<example>>
}
@enduml

However either the text within double angle brackets is shown AND the formatting is applied, or the text is hidden (due to the $ sign, I'd imagine) AND formatting is not applied.
Quite possibly, I might have misunderstood the whole thing: if that's the case, apologies in advance.

1 Answer

+2 votes
answered Nov 6, 2016 by plantuml (295,000 points)
selected Nov 7, 2016 by rony76
 
Best answer

Hi,

You shoud probably use the hide stereotype command.

This is not very documented for component diagrams, but the syntax is the same as for class diagrams (see http://plantuml.com/class-diagram#Hide )

http://www.plantuml.com/plantuml/uml/RP3B2i8m44Nt-OfGly1bePJIhbsv4d4nDjC7JJ9Xag8Y_hifRPMYixrtpXocy04uZ4QBhbSeVK162W-7KlYXjmuOZAp9EB9eWtmA6QU4UcYPHgigqiHPTWMFUIvtQTeqQJftY1NoDYzrNFnFm3iOfwVI2RMcso_ZspW04rdn4i953BGeaoCP35rlssHHF4ydgzLxVraTvd1XRV8FFu8Bj2h-v0q0

@startuml
hide stereotype
skinparam component {
    BackgroundColor<<base>> #99ff99
    BorderColor<<base>> Black
    BackgroundColor<<example>> Yellow
    BorderColor<<example>> Maroon
}

package "Something" {
    [baseComponent1]<<base>>
    [exampleComponent1]<<example>>
}
@enduml

Is this what you are expecting ?

Note that you can play with show and hide commands, by adding rules and exceptions.

Example:

@startuml
hide stereotype
show <<example>> stereotype
skinparam component {
    BackgroundColor<<base>> #99ff99
    BorderColor<<base>> Black
    BackgroundColor<<example>> Yellow
    BorderColor<<example>> Maroon
}

package "Something" {
    [baseComponent1]<<base>>
    [exampleComponent1]<<example>>
}
@enduml

http://www.plantuml.com/plantuml/uml/RP3B2eCm44Nt-OfWlw3BW8ZekgkkIkbYQiO79fcGH6mf_VT6r8gqiprpprmczm5S6BHYRIUH-u0EAJmjSkPR6dcQuWEqLPXbUzXtne83pIlIbWoQm5-CnocWwXj7Wv4bAN9fUWS_fGz2rBKGymuvYMxF2nM3_mrRXGigHUElOziuWICoxCsOZHfea2TdqXZQpZJ9Kl4wdIpNtiVRsc66Ysl7l_uepj78-B0F

Do not hesitate to post other questions!

...