structurizr / dsl

Structurizr DSL
https://docs.structurizr.com/dsl
Apache License 2.0
1.41k stars 265 forks source link

How does one apply a different style depending on the view? #77

Closed chmduquesne closed 3 years ago

chmduquesne commented 3 years ago

I notice that the view blocks can contain styles block, however it seems that the views themselves (systemLandscape, systemContext, container...) cannot be styled independently. This is counter intuitive to me: I would have expected to be able to style things differently depending on the view.

When showing a system (for example in a systemContext view), it would be interesting to highlight this system and show external systems in a different color. For example, if we look at this example from the c4model website, it is clear that the system being shown is the "Internet banking system".

However if I would draw the system context of e.g. the "Mainframe banking system" from the same image, I would clearly swap styles for "Internet banking system" and "Mainframe banking system", to show the "Mainframe banking system" in blue and the other systems in grey.

Is there a way to achieve that in the same worskpace? or do all views of the same workspace automatically have the same style? Do I need a different workspace for each view that I want to style differently?

simonbrowndotje commented 3 years ago

do all views of the same workspace automatically have the same style?

Yes, you'll need to split diagrams across workspaces if you'd like to style them differently.

mattkoch614 commented 2 years ago

@simonbrowndotje - So just to confirm, in the example above the two "gray" systems are from different workspaces?

simonbrowndotje commented 2 years ago

The splitting of workspaces here is referring to rendering the same element differently. For example:

(those two workspaces are created using two separate DSL files, with the workspace extension mechanism, and each has different styling -> https://github.com/structurizr/cli/tree/master/examples/big-bank-plc)