Color¶
-
class
BWAPI.
Color
¶ The
Color
object is used in drawing routines to specify the color to use.Note
Starcraft uses a 256 color palette for rendering. Thus, the colors available are limited to this palette.
See also
Constructors
-
Color
([id = 0])¶ A constructor that uses the color at the specified palette index.
Parameters: id (int) – The index of the color in the 256-color palette.
-
Color
(red, green, blue) A constructor that uses the color index in the palette that is closest to the given rgb values.
On its first call, the colors in the palette will be sorted for fast indexing.
Parameters: - red (int) – The amount of red.
- green (int) – The amount of green.
- blue (int) – The amount of blue.
Note
This function computes the distance of the RGB values and may not be accurate.
Member Functions
-
blue
() → int¶ Retrieves the blue component of the color.
Returns: integer containing the value of the blue component. Return type: int
-
green
() → int¶ Retrieves the green component of the color.
Returns: integer containing the value of the green component. Return type: int
-
red
() → int¶ Retrieves the red component of the color.
Returns: integer containing the value of the red component. Return type: int
-
getID
() → int¶ Retrieves this type’s identifier as an integer.
Returns: An integer representation of this type. Return type: int
-
isValid
() → boolean¶ Checks if the current type has a valid identifier. The purpose of this function is to prevent buffer overflows if a type has been handled improperly.
A type is valid if it is between 0 and Unknown (inclusive).
Returns: true
if this type is valid andfalse
otherwise.Return type: boolean
-
getName
() → string¶ Returns: The variable name of the type. Return type: string
-