@@ -122,7 +122,7 @@ def __init__(
122122 ) -> None :
123123 """Initialize the console."""
124124 self ._key_color : tuple [int , int , int ] | None = None
125- self ._order = tcod ._internal .verify_order (order )
125+ self ._order : Literal [ "C" , "F" ] = tcod ._internal .verify_order (order )
126126 if buffer is not None :
127127 if self ._order == "F" :
128128 buffer = buffer .transpose ()
@@ -345,53 +345,90 @@ def rgb(self) -> NDArray[Any]:
345345 """
346346 return self .rgba .view (self ._DTYPE_RGB )
347347
348+ _DEPRECATE_CONSOLE_DEFAULTS_MSG = """Console defaults have been deprecated.
349+ Consider one of the following:
350+
351+ # Set parameters once then pass them as kwargs
352+ DEFAULT_COLOR = {"bg": (0, 0, 127), "fg": (127, 127, 255)}
353+ console.print(x, y, string, **DEFAULT_COLOR)
354+
355+ # Clear the console to a color and then skip setting colors on printing/drawing
356+ console.clear(fg=(127, 127, 255), bg=(0, 0, 127))
357+ console.print(x, y, string, fg=None)
358+ """
359+
348360 @property
361+ @deprecated (_DEPRECATE_CONSOLE_DEFAULTS_MSG , category = FutureWarning )
349362 def default_bg (self ) -> tuple [int , int , int ]:
350- """Tuple[int, int, int]: The default background color."""
363+ """Tuple[int, int, int]: The default background color.
364+
365+ .. deprecated:: 8.5
366+ These should not be used. Prefer passing defaults as kwargs.
367+
368+ .. code-block::
369+
370+ DEFAULT_COLOR = {"bg": (0, 0, 127), "fg": (127, 127, 255)}
371+ console.print(x, y, string, **DEFAULT_COLOR)
372+ """
351373 color = self ._console_data .back
352374 return color .r , color .g , color .b
353375
354376 @default_bg .setter
355- @deprecated ("Console defaults have been deprecated." , category = FutureWarning )
377+ @deprecated (_DEPRECATE_CONSOLE_DEFAULTS_MSG , category = FutureWarning )
356378 def default_bg (self , color : tuple [int , int , int ]) -> None :
357379 self ._console_data .back = color
358380
359381 @property
382+ @deprecated (_DEPRECATE_CONSOLE_DEFAULTS_MSG , category = FutureWarning )
360383 def default_fg (self ) -> tuple [int , int , int ]:
361- """Tuple[int, int, int]: The default foreground color."""
384+ """Tuple[int, int, int]: The default foreground color.
385+
386+ .. deprecated:: 8.5
387+ These should not be used. Prefer passing defaults as kwargs.
388+ """
362389 color = self ._console_data .fore
363390 return color .r , color .g , color .b
364391
365392 @default_fg .setter
366- @deprecated ("Console defaults have been deprecated." , category = FutureWarning )
393+ @deprecated (_DEPRECATE_CONSOLE_DEFAULTS_MSG , category = FutureWarning )
367394 def default_fg (self , color : tuple [int , int , int ]) -> None :
368395 self ._console_data .fore = color
369396
370397 @property
398+ @deprecated (_DEPRECATE_CONSOLE_DEFAULTS_MSG , category = FutureWarning )
371399 def default_bg_blend (self ) -> int :
372- """int: The default blending mode."""
400+ """int: The default blending mode.
401+
402+ .. deprecated:: 8.5
403+ These should not be used. Prefer passing defaults as kwargs.
404+ """
373405 return self ._console_data .bkgnd_flag # type: ignore
374406
375407 @default_bg_blend .setter
376- @deprecated ("Console defaults have been deprecated." , category = FutureWarning )
408+ @deprecated (_DEPRECATE_CONSOLE_DEFAULTS_MSG , category = FutureWarning )
377409 def default_bg_blend (self , value : int ) -> None :
378410 self ._console_data .bkgnd_flag = value
379411
380412 @property
413+ @deprecated (_DEPRECATE_CONSOLE_DEFAULTS_MSG , category = FutureWarning )
381414 def default_alignment (self ) -> int :
382- """int: The default text alignment."""
415+ """int: The default text alignment.
416+
417+ .. deprecated:: 8.5
418+ These should not be used. Prefer passing defaults as kwargs.
419+ """
383420 return self ._console_data .alignment # type: ignore
384421
385422 @default_alignment .setter
386- @deprecated ("Console defaults have been deprecated." , category = FutureWarning )
423+ @deprecated (_DEPRECATE_CONSOLE_DEFAULTS_MSG , category = FutureWarning )
387424 def default_alignment (self , value : int ) -> None :
388425 self ._console_data .alignment = value
389426
390427 def __clear_warning (self , name : str , value : tuple [int , int , int ]) -> None :
391428 """Raise a warning for bad default values during calls to clear."""
392429 warnings .warn (
393430 f"Clearing with the console default values is deprecated.\n Add { name } ={ value !r} to this call." ,
394- DeprecationWarning ,
431+ FutureWarning ,
395432 stacklevel = 3 ,
396433 )
397434
@@ -737,8 +774,8 @@ def print_frame( # noqa: PLR0913
737774 explicit.
738775 """
739776 self .__deprecate_defaults ("draw_frame" , bg_blend )
740- string = _fmt (string ) if string else ffi .NULL
741- _check (lib .TCOD_console_printf_frame (self .console_c , x , y , width , height , clear , bg_blend , string ))
777+ string_ : Any = _fmt (string ) if string else ffi .NULL
778+ _check (lib .TCOD_console_printf_frame (self .console_c , x , y , width , height , clear , bg_blend , string_ ))
742779
743780 def blit ( # noqa: PLR0913
744781 self ,
0 commit comments