@@ -335,6 +335,33 @@ def rgb(self) -> NDArray[Any]:
335335 The :any:`rgb_graphic` dtype can be used to make arrays compatible
336336 with this attribute that are independent of a :any:`Console`.
337337
338+ Example:
339+ >>> tile_graphics = np.array( # Tile graphics lookup table
340+ ... [ # (Unicode, foreground, background)
341+ ... (ord("."), (255, 255, 255), (0, 0, 0)), # Tile 0
342+ ... (ord("#"), (255, 255, 255), (0, 0, 0)), # Tile 1
343+ ... (ord("^"), (255, 255, 255), (0, 0, 0)), # Tile 2
344+ ... (ord("~"), (255, 255, 255), (0, 0, 0)), # Tile 3
345+ ... ],
346+ ... dtype=tcod.console.rgb_graphic,
347+ ... )
348+ >>> console = tcod.console.Console(6, 5)
349+ >>> console.rgb[:] = tile_graphics[ # Convert 2D array of indexes to tile graphics
350+ ... [
351+ ... [1, 1, 1, 1, 1, 1],
352+ ... [1, 0, 2, 0, 0, 1],
353+ ... [1, 0, 0, 3, 3, 1],
354+ ... [1, 0, 0, 3, 3, 1],
355+ ... [1, 1, 1, 1, 1, 1],
356+ ... ],
357+ ... ]
358+ >>> print(console)
359+ <######
360+ #.^..#
361+ #..~~#
362+ #..~~#
363+ ######>
364+
338365 Example:
339366 >>> con = tcod.console.Console(10, 2)
340367 >>> BLUE, YELLOW, BLACK = (0, 0, 255), (255, 255, 0), (0, 0, 0)
0 commit comments