FxColorPalette โ
This module contains functions for editing the items of a Color Palette. Each color palette has 256 items - or colors - which can be refered to by an ItemIndex. All functions of this module work on the open color palette. To open a color palette use FxFile.Open. An item can only be edited if it is available. To make a new item available use CreateItem. To save the changes made after editing the open color palette use FxFile.Save.
Load โ
FxColorPalette = require "FxColorPalette";Functions โ
| Function | Description |
|---|---|
| Clear () | Deletes all items. |
| CreateItem () | Creates a new item. |
| DeleteItem (ItemIndex) | Deletes an item. |
| GetItemColor (ItemIndex) | Returns the color of an item. |
| GetItemName (ItemIndex) | Returns the name of an item. |
| SetItemColor (ItemIndex, Value) | Sets the color of an item. |
| SetItemName (ItemIndex, Value) | Sets the name of an item. |
Clear () โ
This function deletes all items from the open color palette.
Errors โ
Possible errors include FX_REQUIRED_FILE_UNAVAILABLE
Since โ
Version 1.0
Example โ
FxColorPalette.Clear();CreateItem () โ
This function creates an item, adds it to the opened color palette, initializes it with default values and returns its index.
Returns โ
The ItemIndex of the new item.
Errors โ
Possible errors include FX_REQUIRED_FILE_UNAVAILABLE, FX_FILE_OPERATION_FAILED
Since โ
Version 1.0
Example โ
itemindex = FxColorPalette.Create();DeleteItem (ItemIndex) โ
This function deletes the specified item, making it unavailable.
Parameters โ
- ItemIndex: The ItemIndex of the item to be deleted
Errors โ
Possible errors include FX_REQUIRED_FILE_UNAVAILABLE, FX_ITEM_INDEX_INVALID, FX_ITEM_UNAVAILABLE
Since โ
Version 1.0
Example โ
FxColorPalette.DeleteItem(20);GetItemColor (ItemIndex) โ
This function returns the color of the specified item.
Parameters โ
- ItemIndex: The ItemIndex of the item to query
Returns โ
Errors โ
Possible errors include FX_REQUIRED_FILE_UNAVAILABLE, FX_ITEM_INDEX_INVALID, FX_ITEM_UNAVAILABLE
Since โ
Version 1.0
Example โ
-- get color of item 2
color = FxColorPalette.GetItemColor(2);GetItemName (ItemIndex) โ
This function returns the name of the specified item.
Parameters โ
- ItemIndex: The ItemIndex of the item to query
Returns โ
Name
Errors โ
Possible errors include FX_REQUIRED_FILE_UNAVAILABLE, FX_ITEM_INDEX_INVALID, FX_ITEM_UNAVAILABLE
Since โ
Version 1.0
Example โ
name = FxColorPalette.GetItemName(2);SetItemColor (ItemIndex, Value) โ
This function sets the color of the specified item.
Parameters โ
Errors โ
Possible errors include FX_REQUIRED_FILE_UNAVAILABLE, FX_ITEM_INDEX_INVALID, FX_ITEM_UNAVAILABLE, FX_VALUE_INVALID
Since โ
Version 1.0
Example โ
color = FxColor.CreateFromHex("#ff00ff");
FxColorPalette.SetItemColor(10, color);SetItemName (ItemIndex, Value) โ
This function sets the name of the specified item.
Parameters โ
ItemIndex: The ItemIndex of the item Value: The new name
Errors โ
Possible errors include FX_REQUIRED_FILE_UNAVAILABLE, FX_ITEM_INDEX_INVALID, FX_ITEM_UNAVAILABLE
Since โ
Version 1.0
Example โ
FxColorPalette.SetItemName(10, "Fuchsia");