Name
PALETTE -- define a palette for later use (V9.0)
Synopsis
@PALETTE id[, filename$][, table]
Function
This preprocessor command can be used to define a palette for later use. The palette can either be loaded from a file, it can be one of Hollywood's predefined palettes, or you can define your own palette by specifying a collection of colors.

If you pass the filename$ argument, the palette will be loaded from that file. The file specified in filename$ can either be in the IFF ILBM palette format, as established by Deluxe Paint, or, alternatively, filename$ can also be a normal image file that contains a palette. In that case, @PALETTE will simply extract the palette from the image file. Be advised, though, that if you pass a full image file to @PALETTE and compile your script into an applet or executable, Hollywood will link the whole image file to your applet or executable, which will increase the output file size. Thus, it is advised to only use palette files in the IFF ILBM format with @PALETTE because those are really small as they don't contain any image data.

If you don't pass the filename$ argument, you need to set either the Type or Colors tag in the optional table argument to define the palette (see below). The optional table argument recognizes the following tags:

Type:
Set this tag if you want to use one of Hollywood's predefined palettes. In that case, you must set Type to the identifier of the desired inbuilt palette. See SetStandardPalette for a list of inbuilt palettes. If you set this tag, you must not pass filename$ or Colors.

Colors:
This tag can be used to define a custom palette. If you set Colors, you must not pass filename$ or Type. To define a custom palette, set Colors to a table containing the desired colors for the palette. The palette depth is calculated automatically from the number of colors in the table. Alternatively, you can also set the Depth tag to define the palette depth (see below).

Depth:
The desired depth for the palette. This must be between 1 (= 2 colors) and 8 (= 256 colors). The default is 8. This must only be specified when also setting the Colors tag. If Depth specifies more colors than you pass in the table in the Colors tag, the remaining colors will be initialized to black.

TransparentPen:
This tag can be used to specify the pen that shall be transparent in the palette. This defaults to #NOPEN which means that no pen shall be made transparent. This must only be used when the Type or Colors tag is passed as well.

Link:
Set this field to False if you do not want to have filename$ linked to your executable/applet when you compile your script. This field defaults to True which means that the palette will be linked to your executable/applet when Hollywood is in compile mode. If you use this tag, you must also pass filename$.

Loader:
This tag allows you to specify one or more format loaders that should be asked to load the file specified in filename$. This must be set to a string containing the name(s) of one or more loader(s). Defaults to the loader set using SetDefaultLoader(). See Loaders and adapters for details. If you use this tag, you must also pass filename$.

Adapter:
This tag allows you to specify one or more file adapters that should be asked to open the file specified in filename$. This must be set to a string containing the name(s) of one or more adapter(s). Defaults to the adapter set using SetDefaultAdapter(). See Loaders and adapters for details. If you use this tag, you must also pass filename$.

UserTags:
This tag can be used to specify additional data that should be passed to loaders and adapters. If you use this tag, you must set it to a table of key-value pairs that contain the additional data that should be passed to plugins. See User tags for details. (V10.0)

To load or create palettes at runtime, take a look at the LoadPalette() and CreatePalette() commands.

Inputs
id
a value that is used to identify this palette later in the code
filename$
the palette file you want to load
table
optional: table containing further options
Example
@PALETTE 1, "DPaint32.pal"
Preloads "DPaint32.pal" as palette 1.


@PALETTE 1, {Colors = {#WHITE, #BLACK, $7777CC, $BBBBBB}}
Defines a custom palette as palette 1.


@PALETTE 1, {Type = #PALETTE_CGA}
Defines the standard CGA palette as palette 1.

Show TOC