Style

class tanmatsu.Style(foreground: tuple[int, int, int] | None = None, background: tuple[int, int, int] | None = None, bold: bool | None = None)

Represents the styling available to an invididual character in the terminal.

Parameters
  • foreground (tuple[int, int, int]) – The foreground (text) colour

  • background (tuple[int, int, int]) – The background colour

  • bold (bool) – Whether the text ought to be bold or not

static inherit(other: Style, **kwargs)

Create a copy of other, and then apply the values specified in **kwargs to this copy.

Parameters

other (Style) – other Style object to copy.

For example, assuming we have the base style:

base = Style(forground=(255, 255, 255), background=(0, 0, 0))

we can do:

red = Style.inherit(base, foreground=(255, 0, 0))

to create a clone of the base style, except with a red foreground.