Rhoarke
09-13-2000, 10:15 AM
Anybody know how to increment RGB values to get a color "strip" that represents all the colors b/w black and white (colors included)? Obviously, this will be a gradient, though I can't figure out the sequence of incrementing my values so that they are a normal progression. It didn't take long to find that incrementing all values equally only shows a greyscale gradient. All I want is a rainbow strip, not a pie like in full color editors. In short, what order and by how much should I increment which values. ???
-r
BillSoo
09-13-2000, 01:24 PM
Assuming that you want a strip in a typical "rainbow" order, ROYGBIV, there are a couple of problems. First, black and white aren't in this order. Second, the colours blue and green are right next to each other. This is because the colour mixing formulas used for light aren't the same as used for pigments. There's a word for this but I can't remember it. Anyways, mixing colours in the traditional order is tricky.
But if all you want to do is show all the colours, then just show all the colours from 0 to 16777215. You won't be able to show *all* the colours (unless you have a monitor 16 million pixels across) so you will have to have some kind of increment based on the area available.
"I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder
Rhoarke
09-13-2000, 02:12 PM
Hmmmm... Ok, so there's a "show all the colors from x to x" command? Not sure on this one. Second, even w/o the syntax hurdle, there's the issue of making color 167987 (???) a RGB color. Was your suggestion to increment hex values or what? I can do conversions from hex to RGB and such, but I was hoping for an established pattern of RGB values that I could increment in a loop to show a semi-complete (at least)array of colors. Any further help?
-r
BillSoo
09-13-2000, 07:35 PM
As a demo, I had a form with a picturebox and command button on it.
sub command1_click()
dim i&
dim c#, d#
d# = 16777215#/picture1.width '&HFFFFFF
c# = 0
for i& = 0 to picture1.width
picture1.line (i&,0)-(i&,picture1.scaleheight),clng(c#)
c# = c# + d#
next i&
end sub
This shows as many unique colours, evenly spaced, as possible.
However, as I said before, the palette is not really evenly spaced since RGB aren't the basis of "normal" colour distribution. RYB would be a better approximation.
A simple version would be
for i=0 to 15
c& = qbcolor(i)
next i
"I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder