How to have different font color in class body and header

0 votes
asked Apr 26, 2023 in Question / help by Bryan (340 points)

The following piece of code does the right thing (as in what I want it to do), most of the time:

skinparam classbackgroundcolor mintcream
skinparam classheaderbackgroundcolor navy
skinparam classfontcolor white
class MyClass {
has something in the body
}

Which is to have a dark header with a white font, and a light body (attribute/method area) with a black font.

But I didn't expect it to (I thought the body would end up having a white font), and *sometimes* it doesn't. On one platform where I wasn't aware I had changed anything, it has suddenly done what you might have expected it to ... the font in the class body has gone white. I can't quite work out what has changed.

Why does it do what I want it to do sometimes, and is it possible to do this "the right way"?

Thanks in advance

Bryan

1 Answer

0 votes
answered Apr 27, 2023 by The-Lu (64,340 points)
selected Apr 27, 2023 by Bryan
 
Best answer

Hi B., and all,

You can now use 'style', as:

@startuml
<style>
class {
  BackGroundColor mintcream
  header {
    BackGroundColor navy
    FontColor white
  }
}
</style>
class MyClass {
has something in the body
}
class Class {
    -attr1
    --
    +method1()
}
@enduml

See similar closed issue/defect here:

Enjoy,
Regards.

commented Apr 27, 2023 by Bryan (340 points)

Many thanks. That solves my problem.

However, FYI, it looks like I still have to do an old fashioned 

skinparam classstereotypefontcolor white

to get a visible stereotype in there?

This doesn't seem to work?

<style>
class {
  BackGroundColor mintcream
  header {
    BackGroundColor navy
    FontColor white
  }
  stereotype {
   fontcolor white 
}
}
</style>

...