07-11-2017 11:16 AM
I searched and found a way to generate gradient colors with a start a middle and an end color and then generate the hex code of that color.
The thing is that I need to generate all colors that are close to the middle color, and that's why I used white as start color and black as finish color.
The thing is that to my surprise, I am not getting all the color values I need.
Can someone please help me generate all color value hex codes of the colors that are similar to the middle color value?
07-11-2017 11:50 AM - edited 07-11-2017 11:54 AM
You did not attach your sub vi.
Its easier to do if you think in HEX
Splt numbers is your friend here take a color box constant split it into 2 U16s Split those into 4 U8s Ignore the highest (it is 0)
Pick one R, G, B to remain constant Red is the second U8 Green the Third, Blue the least significant.
Run the other two though something like this
Then join the numbers again (00-R & G- B to u16) and (00R-GB to U32) Bobs your uncle
You can play with inconsistent treatment of the tow variable colors. You might not like it but it might be psychedelic.
07-11-2017 12:45 PM
I have taken a slightly different approach that what Jeff illustrated.
Yes start by splitting the colors into RGB values. Then create a ramp first between Red-Start and Red-Middle (do the same for the G and B) and then generate the ramp for Red-Middle to Red-End (same for the G and B).
Concantenate the R-ramps (same for G and B) then use the three resulting arrays in a For loop to "Join" the RGB back as colors.
No psychedelic effects and nice smooth color ramps.
Ben
07-11-2017 01:02 PM
This thread has a solution on this topic from Greg McKaskle himself.
Ben
07-11-2017 01:10 PM
Can you please help me, by attaching the vi?
I am a complete newbie when it comes to hexadecimal numbers.
Thanks.
07-11-2017 01:14 PM
What I need is all the possible hex color values that are similar to a specific color.
07-11-2017 01:35 PM
@Nando88 wrote:
Can you please help me, by attaching the vi?
I am a complete newbie when it comes to hexadecimal numbers.
Thanks.
Speaking only for myself... No.
1) I would be fired
2) I would screw up a perfectly wonderful and fun opportunity for you to learn about Hex.
Besides, it may not be exactly what you need. Code up what you can figure out, post when you get stuck and someone may be able to help you get over the rough spots.
And remember, Have Fun! After all you get a chance to code this up in LabVIEW.
Ben
07-11-2017 01:43 PM - edited 07-11-2017 01:46 PM
07-11-2017 09:49 PM
Ben wrote:
Concantenate the R-ramps (same for G and B) then use the three resulting arrays in a For loop to "Join" the RGB back as colors.
No need for the FOR loop. The Join Numbers will accept arrays.
Otherwise, my solution would be similar to what you already described.
07-12-2017 10:25 AM
I've used this set of code for doing color gradients in the past.
https://forums.ni.com/t5/Example-Programs/Gradient-Color-Ramp-Scrolling/ta-p/3524938
I don't think it does exactly what you want but might be more flexible.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord