Changing the Background Color of Block Diagrams

Updated Jun 20, 2018

Reported In

Software

  • LabVIEW

Issue Details

I want to change the background color of the block diagram of my current VI or all future VIs I create, for aesthetic or usability purposes. How do I accomplish this?

Solution

There are two approaches to this problem. You can change the default background color for all future VIs made with a particular LabVIEW development environment, and you can edit the background color of an existing block diagram.

Changing the Default Background Color for Block Diagrams of Future VIs:
The setting for block diagram background color is located in the LabVIEW Options.
  1. In LabVIEW, navigate to Tools»Options..., and under Category, choose Environment.
  2. Scroll down to the section titled Colors. Uncheck the box labeled Use default colors.
  3. Now you can choose the colors that new VIs use. To change the background color for the block diagram, click on the colored box labeled Block Diagram, and choose the desired color.

Note that this does not affect VIs that you have already created. These options under the Environment category are shown here:

Editing the color in the LabVIEW Options adds the diagram. background token to the LabVIEW INI file (located in the same folder as LabVIEW.exe). The value for the token is 00 followed by the hex triplet color code representing the chosen color. For a white background, the token appears as follows:


diagram. background=00FFFFFF

Changing the Background Color for Block Diagrams of Existing VIs:
There are two ways to change the block diagram of Existing VIs. You can accomplish this manually or programmatically.

To accomplish this manually for a single VI, open the Tools Palette and choose the Coloring tool. Then, right-click on the block diagram background and you will be able to choose the background color. For more information about this solution, see Coloring Objects and Backgrounds. The following shows what the Coloring tool looks like:

To accomplish this programmatically, there is a block diagram property that can be edited to change the background color of an existing VI. You can potentially use this approach to change the background color for multiple block diagrams quickly.

  1. Enable VI Scripting in LabVIEW. To do this, navigate to Tools»Options..., and under Category, choose VI Server. Check the box labeled Show VI Scripting functions, properties and methods. Choose OK to save the change.
  2. In your LabVIEW code, obtain a reference to the VI you want to edit. If you want to edit the VI you are writing the code in, you can use the default value for the VI Server Reference located in the Functions palette under Programming»Application Control.
  3. Link a property node to the VI reference, and choose the property Block Diagram. This outputs a reference to the block diagram itself.
  4. Link a property node to the block diagram reference, and choose the property Color. If the property is currently readable, right-click the property and select Change to Write.
  5. Obtain a Color Box Constant from the Functions palette by navigating to Programming»Dialog & User Interface. Wire the Color Box Constant to the Color property. The input for the Color property is a numeric integer representing a color, and the Color Box Constant makes it easier to choose the color that represents a given numeric integer.
  6. Click on the Color Box Constant and choose the desired color.
  7. Run the VI that this code is in, and the block diagram background color for the VI you reference will change.

WAS THIS ARTICLE HELPFUL?

Not Helpful