!ClassColors API
This page provides API documentation for my addon !ClassColors.

!ClassColors API Documentation

The following methods are defined on the CUSTOM_CLASS_COLORS table. They are defined using a metatable __index, so pairs() can still be used to iterate over CUSTOM_CLASS_COLORS without requiring extra code to filter out function values.


RegisterCallback

Code:
CUSTOM_CLASS_COLORS:RegisterCallback(method[, handler])
Parameters:
  • method - function or string
  • handler - table containing function value 'method' (required if 'method' is a string, ignored if 'method' is a function)
Notes:
  • Registers a function to be called when class colors are changed.
  • If 'method' is a function, that function will be called with no arguments.
  • If 'method' is a string, 'handler' is a table, and 'handler[method]' is a function, 'handler[method]' will be called with 'handler' as the first argument.
  • If the function is already registered, nothing will happen.

UnregisterCallback

Code:
CUSTOM_CLASS_COLORS:UnregisterCallback(method[, handler])
Parameters:
  • method - function or string
  • handler - table containing function value 'method' (required if 'method' is a string, ignored if 'method' is a function)
Notes:
  • Removes a function from the callback registry.
  • If the function is not registered, nothing will happen.


Implementation Details

Class Colors is built on a proposed community standard for a global table of alternate class colors that can be freely modified without tainting anything. This means that addons must explicitly support this standard (see below for details). Class Colors is only one possible implementation of this standard.

Any implementation must provide the following:
  • Create and populate a global table CUSTOM_CLASS_COLORS with the same keys and value structure as RAID_CLASS_COLORS
  • Define methods :RegisterCallback, and :UnregisterCallback on the CUSTOM_CLASS_COLORS table (see API documentation above), using a metatable __index so that people can still iterate over the table using pairs() without having to work around function values
The following are highly recommended, and generally expected, but won't technically break anything if they aren't provided:
  • Provide a facility by which users may change class colors
  • Store changed class colors between sessions
  • Maintain a registry of functions requesting callbacks when class colors are changed, and call those functions when appropriate (see API documentation above)
  • Apply user-defined class colors to the Blizzard UI
 
Stats
Files: 43
Downloads: 929,532
Favorites: 5,642

Menu
» Home



Content

New & Updated


WOWInterface