skinparam with multiple stereotype dependencies

0 votes
asked Dec 28, 2020 in Question / help by kirchsth (600 points)

I have some overlapping stereotype dependent skinparameter like below with 2 different background colors.
How can I define it, that all 3 exampleBase... are violet?

Thank you and best regards

Helmut

@startuml

skinparam component {
    ' only an "explicit combined" definition is supported
    BackgroundColor<<example|base>> Violet
    ' but not a list of 2
    BackgroundColor<<example>><<base>> Violet
    BackgroundColor<<base>> LightBlue
    BackgroundColor<<example>> Red
}

    [origComponent]
    [baseComponent1]<<base>>
    [exampleComponent1]<<example>>
    [exampleBaseComponent1]<<example|base>>
    [exampleBaseComponent2]<<base>><<example>>
    [exampleBaseComponent3]<<example>><<base>>

origComponent <-U- baseComponent1
origComponent <-U- exampleComponent1
baseComponent1 <-U- exampleBaseComponent1
exampleComponent1 <-U- exampleBaseComponent1
@enduml

 

commented Dec 28, 2020 by Martin

I think you meant to file this as a wanted feature (to be able to define styles for stereotype combinations that take precedence over the individual stereotype styles).

But to answer your question on how your idea can be achieved, here's one method using a custom procedure:

@startuml
skinparam component {
    BackgroundColor<<example|base>> Violet
    BackgroundColor<<base>> LightBlue
    BackgroundColor<<example>> Red
}

!procedure MyComponent($name, $stereo)
!if ($stereo == "<<example>><<base>>" || $stereo == "<<base>><<example>>") 
#Violet $name $stereo
!else
$name $stereo
!endif 
!endprocedure

    MyComponent("[origComponent]", "")
    MyComponent("[baseComponent1]", "<<base>>")
    MyComponent("[exampleComponent1]", "<<example>>")
    MyComponent("[exampleBaseComponent1]", "<<example|base>>")
    MyComponent("[exampleBaseComponent2]", "<<base>><<example>>")
    MyComponent("[exampleBaseComponent3]", "<<example>><<base>>")

origComponent <-U- baseComponent1
origComponent <-U- exampleComponent1
baseComponent1 <-U- exampleBaseComponent1
exampleComponent1 <-U- exampleBaseComponent1
@enduml

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:

[Antispam2 Feature: please please wait 1 or 2 minutes (this message will disappear) before pressing the button otherwise it will fail](--------)
To avoid this verification in future, please log in or register.
...