Example Code

Building a Color Box with RGB Components Using LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Overview

This VI allows the user to build a Color Box with RGB Components

 

Description

This VI shows the inner working of a color box. We normally place a color box control and forget about it, but this VI shows how to build A Color Box programmatically using RGB components. A color box is a U32 number, with four 8-bit planes. The planes are red, green, blue, and Alpha. The Alpha bit is normally zero for a typical color. However, it is used as ’1’ if the user wants the color to be transparent.

 

Requirements

LabVIEW 2012 (or compatible)

 

Steps to Implement or Execute Code

1. Run the VI
2. Modify the Green, Red and Blue Controls
3. Press Alpha, if you want the Color Box to be transparent

 

Additional Information or ReferencesColor Box Control LV2012 NI Verified BD.png

 

 

 

 

 

 **This document has been updated to meet the current required format for the NI Code Exchange.**

Chris Van Horn
Applications Engineer

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
seeker169
Member
Member
on

In the 2012 version, there needs to be a "To U8" after the "Boolean to (0,1)" function for the transparancy part of this to work.

carlos_camargo
Member
Member
on

I think this is a nice simple little tool for generating colors, I found it useful for my needs in figuring out how to dim an LED.  As seeker169 pointed out, the "To U8" is necessary for transparency to work but it is also needed for the Red aspect to contribute.  I changed the 2012 vi to incorporate the change recommended by seeker169.