Name
SetGradientPalette -- create color gradient in palette (V9.0)
Synopsis
SetGradientPalette(id, startcolor, endcolor)
Function
This function creates a color gradient in the palette specified by id. The first pen will be initialized to the color specified in startcolor and the last pen will be initialized to the color specified in endcolor. All pens between the first and the last pen will be filled with intermediary colors so that the result will be a smooth gradient between startcolor and firstcolor. Obviously, the more colors the palette has, the smoother the resulting gradient will be so it's recommended to set the palette depth to 8 (= 256 colors) for the best result.

Inputs
id
identifier of palette to use
startcolor
start color of the gradient
endcolor
end color of the gradient
Example
@DISPLAY {Palette = #PALETTE_DEFAULT, Height = 512}
CreatePalette(1)
SetGradientPalette(1, #BLACK, #BLUE)
SetPaletteMode(#PALETTEMODE_PEN)
SetPalette(1)
SetFillStyle(#FILLCOLOR)
For Local y = 0 To 255
    SetDrawPen(y)
    Box(0, y * 2, 640, 2)
Next
The code above creates gradient between black and blue in palette 1 and draws it.

Show TOC