@@ -360,7 +360,7 @@ def __init__(self):
360360 self ._default_fg = _format_color ((255 , 255 , 255 ))
361361 self ._default_bg = _format_color ((0 , 0 , 0 ))
362362 self ._default_blend = _lib .TCOD_BKGND_SET
363- self ._color_key = _ffi .NULL
363+ self ._color_key = _ffi .new ( 'TCOD_color_t *' , ( 0 , 0 , 0 ))[ 0 ]
364364
365365 def _normalizePoint (self , x , y ):
366366 """Check if a point is in bounds and make minor adjustments.
@@ -464,7 +464,7 @@ def set_colors(self, fg=None, bg=None):
464464 if bg is not None :
465465 self ._default_bg = _format_color (bg , self ._default_bg )
466466
467- def set_color_key (self , bg = None ):
467+ def set_color_key (self , bg = ( 0 , 0 , 0 ) ):
468468 """Sets the transparent color key of this instance.
469469
470470 @type bg: (r, g, b), int, or None
@@ -476,11 +476,8 @@ def set_color_key(self, bg=None):
476476 @see: L{blit},
477477 @since: 1.5.0
478478 """
479- bg = _format_color (bg , - 1 )
480- if bg == - 1 :
481- bg = _ffi .NULL
482- else :
483- bg = _ffi .new ('TCOD_color_t *' , bg )
479+ bg = Color (bg )
480+ bg = _ffi .new ('TCOD_color_t *' , tuple (bg ))[0 ]
484481 self ._color_key = bg
485482
486483 def print_str (self , string ):
0 commit comments