Products & Services Industries Academia Support User Community Company

Learn more about Simulink   

Specifying Block Diagram Colors

How to Specify Block Diagram Colors

You can specify the foreground and background colors of any block or annotation in a diagram, as well as the diagram's background color. To set the background color of a block diagram, select Screen color from the Format menu. To set the background color of a block or annotation or group of such items, first select the item or items. Then select Background color from the Format menu. To set the foreground color of a block or annotation, first select the item. Then select Foreground color from the Format menu.

In all cases, a menu of color choices is displayed. Choose the desired color from the menu. If you select a color other than Custom, the background or foreground color of the diagram or diagram element is changed to the selected color.

Choosing a Custom Color

If you choose Custom, The Simulink Choose Custom Color dialog box is displayed.

The dialog box displays a palette of basic colors and a palette of custom colors that you previously defined. If you have not previously created any custom colors, the custom color palette is all white. To choose a color from either palette, click the color, and then click the OK button.

Defining a Custom Color

To define a custom color, click the Define Custom Colors button on the Choose Custom Color dialog box.

The dialog box expands to display a custom color definer.

The color definer allows you to specify a custom color by

The color that you have defined in any of these ways appears in the Color|Solid box. To redefine a color in the Custom colors palette, select the color and define a new color, using the color definer. Then click the Add to Custom Colors button on the color definer.

Specifying Colors Programmatically

You can use the set_param command at the MATLAB command line or in an M-file program to set parameters that determine the background color of a diagram and the background color and foreground color of diagram elements. The following table summarizes the parameters that control block diagram colors.

ParameterDetermines

ScreenColor

Background color of block diagram

BackgroundColor

Background color of blocks and annotations

ForegroundColor

Foreground color of blocks and annotations

You can set these parameters to any of the following values:

For example, the following command sets the background color of the currently selected system or subsystem to a light green color:

set_param(gcs, 'ScreenColor', '[0.3, 0.9, 0.5]')

Displaying Sample Time Colors

The blocks and lines in your model can be color coded to indicate the sample rates at which the blocks operate.

ColorUse

Black

Continuous sample time

Magenta

Constant sample time

Red

Fastest discrete sample time

Green

Second fastest discrete sample time

Blue

Third fastest discrete sample time

Light Blue

Fourth fastest discrete sample time

Dark Green

Fifth fastest discrete sample time

Orange

Sixth, seventh, eighth, etc., fastest discrete sample time

Yellow

Indicates a block with hybrid sample time, e.g., subsystems grouping blocks and Mux or Demux blocks grouping signals with different sample times, Data Store Memory blocks updated and read by different tasks.

Cyan

Blocks in triggered subsystems

Brown

Variable sample time. See the Pulse Generator block and How to Specify the Sample Time for more information

Gray

Fixed in minor step

To enable the sample time colors feature, select Sample Time Colors from the Format menu.

The Simulink software does not automatically recolor the model with each change you make to it, so you must select Update Diagram from the Edit menu to explicitly update the model coloration. To return to your original coloring, disable sample time coloration by again choosing Sample Time Colors.

The color that is assigned to each block depends on its sample time relative to other sample times in the model. This means that the same sample time may be assigned different colors in a parent model and in models that it references. (See Referencing a Model.)

For example, suppose that a model defines three sample times: 1, 2, and 3. Further, suppose that it references a model that defines two sample times: 2 and 3. In this case, blocks operating at the 2 sample rate appear as green in the parent model and as red in the referenced model.

It is important to note that Mux and Demux blocks are simply grouping operators; signals passing through them retain their timing information. For this reason, the lines emanating from a Demux block can have different colors if they are driven by sources having different sample times. In this case, the Mux and Demux blocks are color coded as hybrids (yellow) to indicate that they handle signals with multiple rates.

Similarly, Subsystem blocks that contain blocks with differing sample times are also colored as hybrids, because there is no single rate associated with them. If all the blocks within a subsystem run at a single rate, the Subsystem block is colored according to that rate.

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS