[id] = CreatePalette(id[, data, t])
id
to it. The data
argument may either be a table containing a number of colors that should be used to
initialize the palette's pens or you may set data
to one of Hollywood's predefined
palette types. See below for all predefined palette types supported by Hollywood.
If you pass Nil in the id
argument, CreatePalette()
will automatically
choose an identifier for the new palette and return it to you.
The following predefined palette types are supported by Hollywood:
#PALETTE_MONOCHROME:
#PALETTE_GRAY4:
#PALETTE_GRAY8:
#PALETTE_GRAY16:
#PALETTE_GRAY32:
#PALETTE_GRAY64:
#PALETTE_GRAY128:
#PALETTE_GRAY256:
#PALETTE_CGA:
#PALETTE_OCS:
#PALETTE_EGA:
#PALETTE_AGA:
#PALETTE_WORKBENCH:
#PALETTE_MACINTOSH:
#PALETTE_WINDOWS:
#PALETTE_DEFAULT:
#PALETTE_AGA
. If you omit the data
argument, CreatePalette()
will initialize the new palette using the pens from #PALETTE_DEFAULT
.
If you pass a table of colors in the data
argument, make sure that all colors
are passed as RGB values. Note that the table can also be a
sparse array with only the pens initialized that you actually need. Pens that
aren't in the data
table will be initialized to black. See below for an example.
The optional table argument t
can be used to specify further options.
The following options are currently recognized:
Depth:
Depth
specifies more colors than
you pass in the table in the data
parameter, the remaining colors will be initialized
to black. This tag is only used if you pass a table in the data
argument.
If you pass a predefined palette type in data
, the predefined palette type's
depth overrides the depth specified here.
TransparentPen:
#NOPEN
which means that no pen shall be made
transparent.
Cycle:
Cycle
, each subtable
describing a configuration of a color cycling effect. Each subtable supports
the following tags:
Low:
High:
Rate:
Reverse:
True
, the colors should be cycled in reverse.
Defaults to False
.
Active:
False
, the color range will be marked as inactive.
Defaults to True
.
#PALETTE_DEFAULT
)CreatePalette(1, {#RED, #GREEN, #BLUE}, {Depth = 2})The code above creates a palette with four colors initialized to red, green, blue and black.
CreatePalette(1, {[0] = #RED, [127] = #BLUE, [255] = #GREEN})The code above creates a new palette with 256 colors and initializes pen 0 to red, pen 127 to blue, and the last pen to green. All other pens will be initialized to black.
CreatePalette(1)Creates a new palette and initializes its colors to those of
#PALETTE_DEFAULT
.
CreatePalette(1, #PALETTE_CGA)Creates a new palette using the CGA colors.