Package horizons :: Package util :: Module color :: Class Color
[hide private]
[frames] | no frames]

Class Color

source code

Class for saving a color.

Colors are saved in 32 bit rgb-format with an alpha value (for transparency). 32bit mean
that each of the for values can only occupy 8 bit, i.e. the value is between 0 and 255.

Attributes:
    r, g, b, a: Color values + Alpha
     name: name of the Color or None

Instance Methods [hide private]
 
__init__(self, r=0, g=0, b=0, a=255) source code
 
to_tuple(self)
Returns color as (r, g, b)-tuple, where each value is between 0 and 255
source code
 
is_default_color(self) source code
 
__str__(self) source code
 
__eq__(self, other) source code
 
__hash__(self) source code
Class Methods [hide private]
 
get_defaults(cls)
Returns an iterator over all available colors in the db.
source code
 
get(cls, key)
Gets a color by name or id from the db.
source code
Method Details [hide private]

get_defaults(cls)
Class Method

source code 
Returns an iterator over all available colors in the db.

for color in Color.get_defaults():
    print(color)

get(cls, key)
Class Method

source code 

Gets a color by name or id from the db.

Color.get('red') Color.get(5)

is_default_color(self)

source code 
Decorators:
  • @property