Change the background color (body and header) of a single class

0 votes
asked Mar 24 in Question / help by pieroangela (120 points)

I have a problem I can't solve with background. I have a diagram like

@startuml
class "Foo Ale" as FooAle {
 bar1
 bar2
}
class "Another Food Ale" as FooAle2 {
 maybeBar1
 maybeBar2
}
@enduml

and I want to change the background (header and the body of the class) only for Foo2. I can't do that apparentely.

The skiparam for class will change it, but not to the header, and will do to all instances for a class.
The notation like

class "Another Food Ale" as FooAle2 #9f9f9f {

works only for the body, but does not change the header. Few other solutions I found online do not work as well. Which is the correct way for doing it?

thanks

1 Answer

0 votes
answered Mar 24 by The-Lu (45,860 points)

Hello P.,

  • What is your PlantUML version?

See result on last version:

@startuml
class "Foo Ale" as FooAle {
 bar1
 bar2
}
class "Another Food Ale" as FooAle2 #9f9f9f {
 maybeBar1
 maybeBar2
}
@enduml

If that can help,
Regards,
Th.

commented Mar 24 by pieroangela (120 points)
My plantuml is 1.2021.07
Interesting that it works. Copy that example made me realize that if I add

<style>
document {
Margin 40 40 40 40
}

arrow {
LineColor black
FontColor black
FontSize 10
FontStyle bold
Arrowthickness 50
}
</style>

it stops working, although there's nothing that changes the colour in the style.

commented Mar 24 by The-Lu (45,860 points)

Hello P.,

There are a lot of new enhancements with v1.2022.2.

Perhaps to update to this new version:

Here is the final result, with the last version:

Regards.

...