Page tree
Skip to end of metadata
Go to start of metadata



The first part of the Style tab deals with shape color.  Clicking any of the color blocks will set selected shape(s) to the designated color.  We can select from a wider range of colors by clicking the color block button to the right of the Fill tick box. This will bring up a color chart screen.


 

You can select a color for the background using either the finely graded color chart, or the coarser one underneath it. If you use the finely graded color chart, note that once you have made a selection, you can tune the color very precisely using the slider bar on the right hand side of the main chart.

The text field will display the hexadecimal representation of the three primary color components (red, green, blue) for the currently selected color, and the field background will also change to the selected color. The default selection is white.

Once you are satisfied with your choice, press Apply to set the fill to that color. Below we have chosen a brown background. Note that the fill color block button will change color to reflect your choice.

If you want to have a shape with no color, simply untick the Fill tick box to remove color fill.

You don't have to fill using one solid color.  You can instead have the color vary gradually between two colors.  To do this, you need to have the Gradient tick box ticked.  This will cause another color block button to appear, and you can go through the same process as you did with the Fill color.  Once you have chosen both colors, you then decide in which direction you want the color gradient to go.  Below we have kept the fill color, and added a gradient color of pale yellow, with a South facing gradient.

There is a black line border around the shape by default.  To change the line color, click the color block button to the right of the Line tick box, and again follow the same color selection procedure.  Below we have chose a red line border.

There are further options for customising the line: you can choose dotted or dashed lines, change the line thickness, or remove the line altogether.  It is also possible to set a perimeter space around the line, which will create white space between the shape and any attached connectors (this effect is purely visual - the connectors will function as usual).

The next style option allows you to vary the shape's opacity, which is the opposite of transparency.  A shape with 100% opacity is not transparent at all, whereas a shape with 0% opacity is completely transparent.  Here were show the same shape that we had before, on the same white background, but with an opacity of 30%.


The next style options apply various effects to the shape.  How many effects are available depends on the shape.  For the rectangle, all three are available.  They are as follows:

Rounded: This rounds the corner of the shape

Shadow: This applies a shadow to the shape

Glass: This adds a reflection effect to the surface of the shape

We can see all three of these effects below, in the order listed.  The middle effect, shadow, is quite faint and difficult to see outside of draw.io.

Using Styles

All of the options chosen for a shape - or left as default - together define how the shape will appear.  This is called the shape's style.  This information can be stored, altered, and even transferred to other shapes.

Although you will define a style by applying it to a particular shape, it is not possible to define a separate style just for an individual shape, or even for all instances of the same shape (i.e. all rectangles).  The style information is global, and when you apply a style to different shapes, it is the same style: the one that you last saved.

At the bottom of the Style tab are a number of buttons pertaining to the use of styles in your diagram.  We will use an example to demonstrate their use.  We will start with one of the shapes from the previous diagram: the rounded rectangle on the left.

Edit Style

Let us start by selecting the rectangle, and the pressing the Edit Style button, this brings up a window showing the XML information corresponding to the style of that shape.

Notice that we have set the perimeter spacing to 10 (default value is 1).  The effect of this will become apparent later.




It is fairly straightforward to relate different formatting statements to different properties of the shape.  For instance, shadow and glass effects are both switched off, while rounded is on.  The different colors have exactly the same hexadecimal representation that we saw when we chose them.

We can change the values given here, and press Apply, and the shape will adjust its style (and thus its appearance).  The Style tab controls will also change to reflect any edits that are made here.

For instance, let us change the fill color from brown to green.  A hexadecimal value of 00FF00 will give green, so we will change fillColor to this value (see highlighted section below).

 


When we press Apply, we can immediately see the change; the fill color is now green rather than brown.  All other aspects of the style remain unchanged.

We have already seen that all of the colors in a style are optional; they can be switched off if desired. So, if we wanted to remove the color gradient from the style, we do this by removing the section that sets gradientColor.

 

 

The rectangle is now filled with a solid block of green.

Copy Style and Paste Style

Now we shall look at one way to transfer the style setting between shapes.  Let us drag a cylinder from the General symbols menu onto our work space.

Because we have just added this shape, it only has the default style information.  If we want it to share the same style as the rectangle, then we follow this procedure:

  1. Click on the rectangle, and then press the Copy style button.
  2. Click on the cylinder, and then press the Paste style button.

The cylinder now has the same style information as the rectangle.

Actually, the style information is not exactly the same, because the effect options that are available for a cylinder shape are not the same as for a rectangle, as can be seen below.

 

 

Only the shadow option is available; neither glass nor rounded can be set for a cylinder.  The rounded setting that we set for the rectangle has not been transferred, although since a cylinder doesn't have any edges, we wouldn't notice the difference anyway.

 

Set as default style and clear default style

Let us delete the cylinder, and replace it with the brown rectangle we had earlier.

Now let us select the green rectangle and press the Set as default style button.  This causes any new added shapes to automatically have the same style settings as the green rectangle.

Let us now add a triangle from the General symbols menu.

 


As we would expect, the triangle matches the style of the green rectangle.  Let us now select the brown rectangle, and perform a copy on connect by clicking the blue + sign on the right of the shape.

 

 

 

This new rectangle is a exact copy of the first brown rectangle, and takes all style settings from its parent, not from the current set style settings.

Incidentally, the arrow does not appear to touch either shape, even though it is connected to both and will move as they move.  This is because we set the shape's perimeter spacing to 10 from the default value of 1.

 

Finally, we can unselect all of the shapes, which causes the Format panel to reappear on the right hand side of the screen.

 

 

Pressing the Clear default style button at the bottom will clear all of the global style settings.  Newly added shapes will no longer use the saved style settings (currently those of the green rectangle), and will instead use the default settings.

 

 

 

  • No labels