It is possible to define a group of attributes as a style and later apply them collectively, see Styles.
Styles can be defined using the defstyle
command,
as below.
defstyle stylename, ... [ attribute=value | style, ... ], ... ;
First you list the name of the style(s) to define then the attributes and their intended values. Similar to color names, style names are case-sensitive and can only contain letters, numbers, underscores and dots, but can not start with a number or a dot and can not end with a dot. You do not have to specify all possible attributes, just those you want to modify with the style. The rest of the attributes will remain unspecified. When you apply the style to an element, attributes of the element that are unspecified in the syle are left unchanged.
You can also enlist styles among the attributes. In this case the
newly defined style inherits all the attributes specified in that style.
If you apply a style to an element, those attributes of the style, which
not applicable to that particular element type are simply ignored. For example,
applying a style including fill.color
to an arrow will silently ignore
the value of the fill.color
attribute.
The same syntax above can be used to extend and modify styles. You can add new attributes to an existing style or modify existing attributes. This is when listing multiple styles comes in handy. You can set attributes to the same value in multiple styles in a signle command. Re-defining an existing style do not erase the attributes previously set in the style. Only the new attribute definition is added - changing the value of the attribute if already set in the style.
It is also possible to unset an attribute by specifying the attribute name, followed by the equal sign, but no value.
There are a number of default, built-in styles that govern the default appearance of elements. By modifying these you can impact, e.g., all the arrows in a chart or all edges in a graph. This is how chart designs operate: by modifying the built-in styles.
If you want to change a set of attributes for multiple elements (such as both for arrows and dividers) simply list these separated by commas before the attributes.
It will apply to both.
In addition to default styles, most languages have a number of refinement styles.
Such styles may contain some attributes set and are applied after and in addition to
default styles. For example, after applying the default arrow
style to
a message in a signalling chart or an arrow of a block diagram, specified as a=>b;
,
an additional refinement style, named =>
is applied, making the arrow double-lined.
Redefining refinement enables you to quickly define, e.g., various arrow styles and use the various symbols as shorthand for these.
Thus, in summary the actual attributes of an element are set using the following logic. (There are minor variances for each language.)
text.*
for signalling charts. In order for these chart options to be effective
default styles usually have no value specified for these attributes. You can set
these attributes in styles, e.g., to set font type for empty boxes,
which will take precedence over chart options.