Next: Module field, Previous: Module character, Up: Top [Contents][Index]
In this module are constants and a few functions about colors. To give an Obj color override it’s color method and return the color-code of the color you want. See color-codes. You can also define you own colors. This is documented below.
An colorcode in Cursgame is a function returning an int that curses can interprete as a color. That they’re a function is due to internal problems of Cursgame. In the color method you anyway just need to return the colorcode as they are defined here, without calling them. The color-codes defined here are:
If you want to define own colorcodes you do it almost the wayy you
would do it in curses. First you need to register a color-pair with
cursgame.color.init_pair
(Documented in the python-curses
documentation). Once you registered the pair to curses you can get
the value associated with it with cursgame.color.color_pair
(Again see curses documentation). Once you defined a color_pair you
need to make it a valid Cursgame-color-code. You can do this by
passing the return value of color_pair
to
cursgame.color.make_colorcons
, this function will return the
cursame-color code.
For defining new color pairs you need the raw colors provided by
curses. The color module imports them under other names than they are
defined in curses. In Cursgame they are called X_RAW
where
thy are called COLOR_X
in curses. So for example
cursgame.color.BLACK_RAW
links to curses.COLOR_BLACK
.
Next: Module field, Previous: Module character, Up: Top [Contents][Index]