Book a Demo

Author Topic: Set background color of custom stereotype in MDG Technology Profile  (Read 7471 times)

ea0220

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Hi,

let's say I have multiple stereotypes that extend Class in a profile. I'd like to change the background color of each one of them to make it easier to differentiate between them. (So that let's say one in red and another one in green and a third one should keep the classes default blue). Is it possible to do that in the profile - e.g. by specifying a certain attribute to the stereotype?

I've found this very old issue mentioning there is a possibility to do that, but it also mentions that this possibility will be changed. The issue is from 2012 so I assume this change has been implemented by now. I've tested the mentioned solutions, but they do not work.
https://www.sparxsystems.com/forums/smf/index.php/topic,4403.0.html

Greetings

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Set background color of custom stereotype in MDG Technology Profile
« Reply #1 on: July 02, 2020, 08:53:12 pm »
You would still do it this way. You apply a shape script to your stereotype to set the color. That also gives you the possibility to, say, set the color differently on certain settings.

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Set background color of custom stereotype in MDG Technology Profile
« Reply #2 on: July 02, 2020, 08:56:06 pm »
The trick with the default appearance (F4) works for me when exporting a UML profile from a package. (I did one today on version 15.2.1528)
Make sure you check the "color and appearance" checkbox when generating the profile xml.

When generating from a diagram you also might need to set the diagram appearance, and not only the default appearance.

This method sets the default appearance of elements and allows users to choose a different appearance.
If you want to set a fixed appearance that cannot be changed by the user, you can use the shapescript.

Geert

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: Set background color of custom stereotype in MDG Technology Profile
« Reply #3 on: July 03, 2020, 07:54:24 am »
Have a look at diagram legends. They can set the colour of all elements on a diagram that match  specified criteria.
The Sparx Team
[email protected]

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Set background color of custom stereotype in MDG Technology Profile
« Reply #4 on: July 03, 2020, 08:56:36 am »
If you want to set a fixed appearance that cannot be changed by the user, you can use the shapescript.
The color set by shape scripts before calling DrawDefaultShape can still be overridden with a local diagram color.

Colors set before explicit draw commands can't be overridden.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Set background color of custom stereotype in MDG Technology Profile
« Reply #5 on: July 03, 2020, 02:58:38 pm »
If you want to set a fixed appearance that cannot be changed by the user, you can use the shapescript.
The color set by shape scripts before calling DrawDefaultShape can still be overridden with a local diagram color.

Colors set before explicit draw commands can't be overridden.
Learn something new every day!

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

ea0220

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Set background color of custom stereotype in MDG Technology Profile
« Reply #6 on: July 04, 2020, 12:28:15 am »
Thanks for the answers.

Have a look at diagram legends. They can set the colour of all elements on a diagram that match  specified criteria.

We'll go with diagram legends because it's the variant which is most transparent to users.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Set background color of custom stereotype in MDG Technology Profile
« Reply #7 on: July 06, 2020, 08:35:04 am »
Learn something new every day!
Or the same thing once every couple of years.  ;)

The colours set by a shape script are only overridable if you call drawnativeshape.

You probably didn't see this one. It was before auto colored legends were introduced though, they would be somewhere near the top.
This is to my knowledge, the complete list of overrides for the drawing style of elements.

  • Print in Color - User option for black and white only during printing.
  • Whiteboard mode - Suppresses fill colours and gradients. Set for a diagram
  • Shape Script Rendering - Any drawing properties explicitly set in a shape script before explicit draw commands.
  • Local Appearance - The user configured appearance of the object on this particular diagram. Set on the toolbar.
  • Shape Script Defaults - Any drawing properties explicitly set in a shape script before drawing the native shape.
  • Default Appearance - The user configured default appearance for this object on any diagram.
  • Stereotype Appearance - The appearance for any objects created with this stereotype as configured by the profile order.
  • Element Group Colours - (Optional) Fill colours for different element types configured by Sparx. Enabled in local diagram theme or user settings
  • Local Diagram Theme - Theme override set by a user for an individual diagram.
  • User Style Settings - Defaults set for appearance of all elements for a user. Can be set via a theme.
  • Global Defaults - Defaults for the user settings defined by Sparx.
« Last Edit: July 06, 2020, 11:17:58 am by Eve »