Palette
A palette containing (up to) 256
Constants
Name | Value |
---|---|
FORMAT_RAW |
0 |
FORMAT_IMAGE |
1 |
FORMAT_CSV |
2 |
FORMAT_JASC |
3 |
FORMAT_GIMP |
4 |
MATCH_DEFAULT |
0 |
MATCH_OLD |
1 |
MATCH_RGB |
2 |
MATCH_HSL |
3 |
MATCH_C76 |
4 |
MATCH_C94 |
5 |
MATCH_C2K |
6 |
Properties
Property | Type | Description |
---|---|---|
The number of colours in the palette |
Constructors
Creates a new palette with 256 colours in a greyscale gradient (from black to white).
Creates a new palette with
Parameters
count (integer ): The number of colours in the palette
Functions
Overview
General
Load/Save
Colour Modification
Colour Range Modification
Colour
Gets the colour at the given
Parameters
index (integer ): The index of the colour to get
Returns
Colour : The colour at the givenindex
CopyColours
Copies all colours from another palette.
Parameters
other (Palette ): The palette to copy from
Notes
This will not change the
CountUniqueColours
Counts the number of unique colours in the palette.
Returns
integer : The number of unique colours present in the palette
FindColour
Finds the index of the first colour in the palette that exactly matches the given
Parameters
colour (Colour ): The colour to find in the palette
Returns
integer : The index of the first matching colour in the palette, or-1
if no match was found
NearestColour
Finds the index of the colour in the palette that most closely matches the given
Parameters
colour (Colour ): The colour to find in the palette[matchMode] (integer ): The colour matching algorithm to use (seeMATCH_
constants). Default isMATCH_DEFAULT
, which means the colour matching algorithm currently selected in the SLADE preferences will be used
Returns
integer : The index of the closest matching colour
LoadData
Loads the given
Parameters
data (string ): The binary data to load[format] (integer ): The format of the data. SeeFORMAT_
constants. Default isFORMAT_RAW
Returns
boolean :true
on success
LoadFile
Loads the file at
Parameters
path (string ): The full path to the file to load[format] (integer ): The format of the file. SeeFORMAT_
constants. Default isFORMAT_RAW
Returns
boolean :true
on success
SaveFile
Saves the palette to a file at
Parameters
path (string ): The full path to the file[format] (integer ): The format of the file. SeeFORMAT_
constants. Default isFORMAT_RAW
Returns
boolean :true
on success
SetColour
Sets the colour at
Parameters
index (integer ): The index of the colour to setcolour (Colour ): The colour to set it to
SetColourR
Sets red component of the colour at
Parameters
index (integer ): The index of the colour in the paletter (integer ): The new red component value
SetColourG
Sets green component of the colour at
Parameters
index (integer ): The index of the colour in the paletteg (integer ): The new green component value
SetColourB
Sets blue component of the colour at
Parameters
index (integer ): The index of the colour in the paletteb (integer ): The new blue component value
SetColourA
Sets alpha component of the colour at
Parameters
index (integer ): The index of the colour in the palettea (integer ): The new alpha component value
ApplyTranslation
Applies a
Parameters
translation (Translation ): The translation to apply
Colourise
Colourises a range of colours in the palette.
Parameters
colour (Colour ): The colour to usefirstIndex (integer ): The index of the first colour to apply tolastIndex (integer ): The index of the last colour to apply to
Tint
Tints a range of colours in the palette.
Parameters
colour (Colour ): The colour to useamount (float ): The amount to tint (0.0
-1.0
)firstIndex (integer ): The index of the first colour to apply tolastIndex (integer ): The index of the last colour to apply to
Saturate
Adjusts the saturation on a range of colours in the palette.
Parameters
amount (float ): The amount to adjust by (0.0
-2.0
)firstIndex (integer ): The index of the first colour to apply tolastIndex (integer ): The index of the last colour to apply to
Illuminate
Adjusts the brightness on a range of colours in the palette.
Parameters
amount (float ): The amount to adjust by (0.0
-2.0
)firstIndex (integer ): The index of the first colour to apply tolastIndex (integer ): The index of the last colour to apply to
Shift
Shifts the hue on a range of colours in the palette.
Parameters
amount (float ): The amount to shift by (0.0
-1.0
)firstIndex (integer ): The index of the first colour to apply tolastIndex (integer ): The index of the last colour to apply to
Invert
Inverts a range of colours in the palette.
Parameters
firstIndex (integer ): The index of the first colour to apply tolastIndex (integer ): The index of the last colour to apply to
Gradient
Converts a range of colours in the palette to a colour gradient from