Activity Diagram Styles - how to apply to different shapes?

0 votes
asked Sep 6, 2023 in Question / help by muteboy (200 points)

I'm drawing an Activity Diagram, and I'm using the different shapes to represent what the actions are.

  • :This is one kind of action/
  • :This is another kind of action|
  • :This is another]
I can use a skinparam to set all Activity boxes to the same format, but I really want to have each shape have its own colour. I'd rather not have to set the colour manually for each one.

Is there a way to say "all Activity boxes of shape X shall be green"?

1 Answer

0 votes
answered Sep 6, 2023 by The-Lu (67,080 points)
selected Sep 7, 2023 by muteboy
 
Best answer

Hello M, and all,

For that you can use `user stereotype` SDL and `style`, (FYI the SDL "/, |, ], >, <, ..." form is now deprecated) as:

@startuml
<style>
element {
  FontColor blue
}
.save {
  FontColor navy
  BackGroundColor Cyan
}
.procedure {
  FontColor green
  BackGroundColor pink
}
.task {
  FontColor red
  BackGroundColor sandybrown
}
</style>
start
split
partition "Simple elt example" {
:simple element;
}

partition "Simple SDL example" {
:input action\nold def<
<<input>>:input action\nwith stereo;
:input action\nwith stereo; <<input>>
}

partition "Your example" {
:This is one kind of action/
:This is another kind of action|
:This is another]
}
split again
partition "Example with stereo\nand style" {
:This is one kind of action\nwith stereo save; <<save>>
:This is another kind of action \nwith stereo procedure; <<procedure>>
:This is another\nwith stereo task; <<task>>

:Another action\nwith stereo save; <<save>>
:Another action \nwith stereo procedure; <<procedure>>
:Another action\nwith stereo task; <<task>>
}
endsplit
@enduml

Ref. (Issue, Wanted feature, ...) about this topic:

Enjoy,
Regards,
Th.

commented Sep 7, 2023 by muteboy (200 points)

Thank you for this! It's what I need.

Applying as stereotype to a multiple-line item only works if you use "\n", it would seem. This is shame, because I have task boxes with lists of items which would be awkward to separate with "\n"

I can't see how to insert an example in a comment, so here's a link to an example: 

https://www.planttext.com/?text=JOv12i8m44NtSufSGDrhACM2NYARqGuQd4uaaxG4yUx6YEZoVzxZ_ruJnfGd1gkfC7K0QyMPp0ECEGH9G-0GZU1SQh77y-qOGvRnKmy51PvWDrztEsLE_ixaXBsGEidgvUBaL4rbrEjATjQ-5xf_71eD3GQXnRJy8tkIiPvy0G00

Also, you say some syntax is deprecated, but it's shown on the main website - what is the best place for up-to-date documentation?

commented Sep 7, 2023 by The-Lu (67,080 points)

Hi M, and all,

Applying as stereotype to a multiple-line item only works if you use "\n", it would seem. This is shame, because I have task boxes with lists of items which would be awkward to separate with "\n"

Thanks for your test, then I just open this issue:

Also, you say some syntax is deprecated, but it's shown on the main website - what is the best place for up-to-date documentation?

For that I had post some modification on:

Awaiting agreement of @Plantuml...

Regards,
Th.

...