Skinparam ArrowColor cannot be combined via multiple stereotypes

0 votes
asked Feb 27, 2021 in Question / help by kirchsth (4,880 points)

Hello,

related to https://forum.plantuml.net/13232/stereotype-specific-skinparam-arrowfontcolor-cannot-changed

I try to set arrow styles via stereotypes. If I set one stereotype then arrow color or arrow font color can be changed individually. But if I combine both stereotypes (one sets the line color the other the font color) then only one color is changed.

@startuml
skinparam Component {
  BorderColor #Green
  FontColor #Green

  BorderColor<<v1.0>> #Red
  FontColor<<v1.1>> #Red
' not required
'  BorderColor<<v1.0&v1.1>> #Red
'  FontColor<<v1.0&v1.1>> #Red
}

skinparam Arrow {
  Color #Green
  FontColor #Green

  Color<<v1.0>> #Red
  Color<<v1.1>> text:Red
  Color<<v1.0&v1.1>> #Red;text:Red
}

[Component]
[Participant]
[Participant10]<<v1.0>>
[Participant11]<<v1.1>>
[Participant1011]<<v1.0>><<v1.1>>
[Participant1110]<<v1.0>><<v1.1>>
'<<v1.0&v1.1>> not required
[Participant1011_WithoutSimulation]<<v1.0>><<v1.1>>   


Component -UP-> Participant: no stereotype
Component -LEFT-> Participant10<<v1.0>> : v1.0 stereotype
Component -RIGHT-> Participant11<<v1.1>> : v1.1 stereotype
Component -DOWN-> Participant1011<<v1.0>><<v1.1>> : v1.0 and v1.1 stereotype (should be red/red)
Component -DOWN-> Participant1110<<v1.1>><<v1.0>> : v1.1 and v1.0 stereotype (should be red/red)
Component -DOWN-> Participant1011_WithoutSimulation<<v1.0&v1.1>> : simulated v1.0 v1.1 (red/red)
@enduml

BR Helmut

1 Answer

0 votes
answered Mar 5, 2021 by plantuml (294,960 points)
selected Mar 6, 2021 by kirchsth
 
Best answer

For some reason (mainly because the internal code of PlantUML is too complex regarding skinparam), we are migrating from "skinparam" to "style" feature, which should provide better option. https://plantuml.com/style-evolution

So with last beta http://beta.plantuml.net/plantuml.jar you can have :

@startuml
<style>
arrow {
  LineColor #Green
  FontColor #Green
  LineStyle 10;5
  
  .va {
  FontColor #Red
  }
  .vb {
  LineColor #Red
  }
}
</style>

[Component]
Component --> Participant10<<va>> : va stereotype
Component --> Participant20<<vb>> : vb stereotype
Component --> Participant30<<va>><<vb>> : va and vb stereotype
@enduml

Does it sound good ?

commented Mar 5, 2021 by kirchsth (4,880 points)

Hi @plantuml,

I really like the new feature (I can even create stashed lines via style), but my problem is that I want to extend C4-PlantUML and the new style feature cannot be mixed with the old skinparam (see below).

Do I have a change to get the skinparams too?

Thank you and best regards
Helmut

@startuml
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Context.puml

' only color sample
!global $EXISTING_SYSTEM_BG_COLOR = "Green"
!global $EXISTING_SYSTEM_BORDER_COLOR = "#8A8A8A"

!unquoted procedure System_Existing($alias, $label, $descr="", $sprite="", $tags="")
rectangle "$getSystem($label, $descr, $sprite)$getProps()" $toStereos("existing_system", $tags) as $alias
!endprocedure

' define a new tag
' !!!! use AddTagSupport
AddTagSupport("existing_system", $bgColor=$EXISTING_SYSTEM_BG_COLOR, $fontColor=$ELEMENT_FONT_COLOR, $borderColor=$EXISTING_SYSTEM_BORDER_COLOR)

' CANNOT BE COMBINED !!!!
<style>
arrow {
  LineColor #Green
  FontColor #Green
  LineStyle 10;5
 
  .va {
  FontColor #Red
  }
  .vb {
  LineColor #Red
  }
}
</style>

[Component]
Component --> Participant10<<va>> : va stereotype
Component --> Participant20<<vb>> : vb stereotype
Component --> Participant30<<va>><<vb>> : va and vb stereotype
' CANNOT BE COMBINED !!!!

Person(customer, "Personal Banking Customer")
System(banking_system, "Internet Banking System")

System_Existing(mail_system, "E-mail system")
System_Existing(mainframe, "Mainframe Banking System")

Rel(customer, banking_system, "Uses")
Rel_Back(customer, mail_system, "Sends e-mails to")
Rel_Neighbor(banking_system, mail_system, "Sends e-mails")
Rel(banking_system, mainframe, "Uses")


' !!!!! you need show dynamic legend
SHOW_DYNAMIC_LEGEND()
@enduml

but orig was

commented Mar 5, 2021 by plantuml (294,960 points)

Yes, mixing style and skinparam does not work well.

You probably have to duplicate following files:
C4.puml
C4_Context.puml

to :

C4_style.puml
C4_Context_style.puml

Those two new files should defines <style> instead of skinparam.

This way, older diagrams could still include legacy "C4.puml" and newer could include "C4_style.puml"
Note that since <style> are somehow new, it is possible that you could not reproduce all behavior of legacy skinparam.
Just tell us if you find some issues and we will fix it (You can post here some little snipset to show us issues).

Those kind of non-compatible change is annoying, but it is necessary to introduce <style> which will be more flexible (and somehow CSS standard) than skinparam.

commented Mar 6, 2021 by kirchsth (4,880 points)
Where can I find the C4_style.puml versions? I didn't find any github entry.
Are they autogenerated?
commented Mar 6, 2021 by The-Lu (63,920 points)

Hello K.,

You must or could create it...
It will to be created from 'C4.puml' to replace all the skinparam instruction on style instruction.

Regards,
Th.

commented Mar 6, 2021 by kirchsth (4,880 points)

Hello Th.,
got it wink
but first I have to finish $tags in C4.puml (with skinparam)
Regards
Helmut

...