Here's a fix. Seems to work but I hope I didn't break anything when I was fixing it, I've had a few tonight!
'copper color generator - MrP.........
screenres 640, 480, 32, 2, 1, 75
screenset 0, 1
setmouse 0, 0, 0
dim copper_height = 53
'dim shared r_inc,g_inc,b_inc as double
dim copper_array(copper_height, 3) as ubyte
r_start = 0 'start rgb values for copper (top and bottom color of bar)
g_start = 0
b_start = 0
r_end = 255 'highest rgb values for copper (middle of bar)
g_end = 100
b_end = 50
r_inc = (r_end - r_start) / (copper_height / 2) 'calculate how much we need to increment each color to get a smooth bar
g_inc = (g_end - g_start) / (copper_height / 2)
b_inc = (b_end - b_start) / (copper_height / 2)
r_value = r_start 'setup the rgb values for storing into array
g_value = g_start
b_value = b_start
copper_line = 0 'start line of copper in our array
while copper_line < copper_height - 1
copper_array(copper_line, 1) = r_value 'store red component in array
copper_array(copper_line, 2) = g_value 'store green component in array
copper_array(copper_line, 3) = b_value 'store blue compnent in array
'if copper_line = (copper_height / 2) then 'check to see if were in the middle of the bar
'r_inc = -r_inc 'if we are make the color increments negative so we fade back out
'g_inc = -g_inc
'b_inc = -b_inc
'end if
if copper_line <= (copper_height / 2) then
r_value + = r_inc 'add the color increment to rgb colors
g_value + = g_inc
b_value + = b_inc
else
r_value - = r_inc 'dec the color increment to rgb colors
g_value - = g_inc
b_value - = b_inc
end if
if r_value > 255 then r_value = 255 'make sure none of them go above 255
if g_value > 255 then g_value = 255
if b_value > 255 then b_value = 255
copper_line += 1 'increment our line in the array
wend
while inkey$ = ""
for copper_y = 0 to copper_height - 1
for copper_x = 0 to 639
pset(copper_x, copper_y), rgb(copper_array(copper_y, 1), copper_array(copper_y, 2), copper_array(copper_y, 3))
next copper_x
next copper_y
screensync
flip
wend
end