LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I need the 256-element color spectrum array for LabVIEW.

The one that runs black, purple, dark blue, light blue, green, yellow, orange, red, pink, white. Using this in Picture functions to plot measured Power vs. X and Y in LabVIEW 6.0.2.
0 Kudos
Message 1 of 10
(5,501 Views)
Not sure which specific color array you are referring to. Did you see this array in a specific example
VI?

My suggestion would be to use the Intensity Graph and then customize the color ramp to your specifications.
There is an example that comes with LabVIEW that shows how to do this. It is found under Help >>
Examples >> Fundamentals >> Graphs & Charts >> Graphs >> Intensity Graph Color Array.

Chris_Mitchell
Product Development Engineer
Certified LabVIEW Architect

0 Kudos
Message 2 of 10
(5,501 Views)
James,

Take an array of 0 to 255, and cast it to the color box (using a single element array of one color - 1D array). Then, take this output, and copy it to your diagram where you need the array. This will give you what you need.

Good luck
Message 3 of 10
(5,501 Views)
LabVIEWguru,
Does your solution require a display setting of 256 colors?
My color is 24 bit and I get a scale from black to blue for that array. I attached a simple VI that shows the red, green, and blue color scales I get on my machine. /Mikael
0 Kudos
Message 4 of 10
(5,501 Views)
Mikael,

This is a lot tougher than I thought. The color palette is 24 bit, with each color being 0-255 (8 bits each). I have examined the colors you indicated and found the following. For each bit (R, G, B) the values are set something like this:

R G B
0 0 0 = Black
128 0 128 = Purple
0 0 128 = Dark Blue
0 128 255 = Light Blue
0 128 0 = Green
255 255 0 = Yellow
255 128 0 = Orange
255 0 0 = Red
255 128 255 = Pink
255 255 255 = White

So, you need to work around something like this, to make your array. The values should be some even division of each bit in a certain order to get your array.

Try looking up color standards and lookup tables. There
should be a 255 bit lookup table in the vision library, or somewhere on the internet.

Sorry if I stirred you the wrong way.

Good luck
0 Kudos
Message 5 of 10
(5,501 Views)
James,
As LabVIEWguru said, this sounds to be a trivial question but it is not...

My solution is similar to LabVIEWguru's. I basically walked in the RGB cube along 7 of the sides to end up with the color spectrum that goes from black to white in the order listed in the question. In the VI I attached I also included a picture of the color cube to explain how it all works. I hope this helps. /Mikael
Message 6 of 10
(5,501 Views)
The results look great, thank you. I still need purple between the black and the dark blue. Would this be easy to change?
0 Kudos
Message 7 of 10
(5,501 Views)
James,
With LabVIEW almost everything is possible... In my first answer I generated the spectrum following seven sides in the color cube. However, as you pointed out, your spectrum is not identical to that spectrum. Too bad...

I did some more thinking and I had to write some neat tools to solve it so that my code can be re-used by others that also want their own spectrums in intensity charts.

This is what I got for you: EasySpectrums.llb is a library file consisting of three VI's. The main vi has the same name as the library, EasySpectrums. Run this VI and you will get your spectrum. I used the values that LabVIEWguru specified for us in his posting. Thanks!

As you will see, the 10 colors in your list are stored in an RGB ar
ray (default values). This array can be tailored to any color combination to get any type of spectrum.

This question was a lot of fun!

I hope this answer helps you and others using custom spectrums in LabVIEW.

/Mikael Garcia
0 Kudos
Message 8 of 10
(5,501 Views)
Your enthusiasm is appreciated. This gave me exactly what I had in mind.

Nine colors were sufficient for right now, so I took the liberty to rename the VI and vary the diagram parameters to accommodate an input row count from two to 256.

Thanks to all who contributed ideas to this problem.
Message 9 of 10
(5,501 Views)
Trying again to upload the variant file ...
0 Kudos
Message 10 of 10
(5,501 Views)