Changing Default Spot Background, Border, and Font Color Based on Component Type (class, abstract, etc.)

0 votes
asked Feb 24, 2023 in Question / help by nathan.k (120 points)

Hello!

I am pretty new to plantUML, and I am looking to set some style for my class diagrams. Specifically, I am looking to change the default colors for spot backgrounds, font colors, and border colors.

For instance, as a default the spot for abstract is a light blue background with black text and border. I would like that to default to having a pink background with white text and a dark red border. However, I would like the class to have a different background, border, and text color.

Here's a plantUML diagram that might help explain what I'm looking for. (Unfortunately I couldn't figure out how to change the border color or font colorfrown)

I was wondering the best way to accomplish this? As much as possible I was hoping to have this be the default behavior, so any class, abstract, etc. included would be styled like this. The goal is to have other developers on our team be able to make diagrams that meet the style guide our marketing team put out for us, so it's nice to have as few hoops to jump through!

1 Answer

0 votes
answered Feb 24, 2023 by plantuml (294,960 points)

Welcome to PlantUML :-)

You can use style for that (see example).

Style is quite new, to there might be bug. The documentation is also not perfect...

Running with "-v" flag in the command line will print some info about which styles are used.

Hope this help and do not hesitate to ask any questions!

commented Feb 24, 2023 by nathan.k (120 points)
This was a big help, thank you! I was able to get that to work in my own UML. Things are looking good!

Is there a way that I can change the font name as well? I tried using FontName in the style blocks, but not seeing any changes at the moment.
commented Feb 24, 2023 by plantuml (294,960 points)
commented Feb 24, 2023 by nathan.k (120 points)
Thank you! Will this also change the font for the spot character as well? I was hoping to change that too if that's at all possible.

Thank you for the `listfonts test` recommendation as well, that's a big help.
commented Feb 27, 2023 by Todd Musheno (2,680 points)
You might want to put a new request in for the font stuff.
commented Feb 27, 2023 by nathan.k (120 points)
Appreciated, I'm a bit new here!
...