Skip to content

Latest commit

 

History

History
46 lines (30 loc) · 1.95 KB

File metadata and controls

46 lines (30 loc) · 1.95 KB

Styling relationships

By default, all relationships are rendered as dashed grey lines as shown in the example diagram below.

Default styling

However, the following characteristics of the relationships can be customized:

  • Line thickness (pixels)
  • Colour (HTML hex value)
  • Line style (dashed or solid)
  • Routing (direct or orthogonal)
  • Font size (pixels)
  • Width (of the description, in pixels)
  • Position (of the description along the line, as a percentage from start to end)

Tagging relationships

All relationships within a software architecture model can have one or more tags associated with them. A tag is simply a free-format string. By default, the Java client library adds the "Relationship" tag to relationships. You can add your own custom tags to relationships using the addTags() method on the relationship.

Colour

To style a relationship, simply create a RelationshipStyle for a particular tag and specify the characteristics that you would like to change. For example, you can change the colour of all relationships as follows.

Styles styles = workspace.getViews().getConfiguration().getStyles();
styles.addRelationshipStyle(Tags.RELATIONSHIP).color("#ff0000");

Colouring all relationships

You can also change the colour of specific relationships, based upon their tag, as follows.

user.getRelationships().forEach(r -> r.addTags("HTTPS"));
styles.addRelationshipStyle(Tags.RELATIONSHIP).color("#3366ff");
styles.addRelationshipStyle("HTTPS").color("#33cc33").dashed(false);

Colouring relationships based upon tag

Diagram key

Structurizr will automatically add all relationship styles to a diagram key.

The diagram key