Renderers

Utility module that provides standardized functions for rendering

class Renderer(plain=False, theme=None)[source]

Renderer provides methods for rendering text using different, predefined colors and styles.

Initialize render utilities.

Parameters:
  • plain (bool) – Whether to use plain text rendering

  • theme (Theme) – Theme instance to use for colors. If None, uses

  • theme. (default)

error(message)[source]

Render a message with a red color.

Return type:

None

Parameters:

message – Text to render

info(message)[source]

Render a message with a bright blue color.

Return type:

None

Parameters:

message – Text to render

markdown(message)[source]

Render markdown formatted text.

Return type:

None

Parameters:

message – Text to render

normal(message)[source]

Render a message with a normal color.

Return type:

None

Parameters:

message (str) – Text to render

notice(message)[source]

Render a message with a bright yellow color.

Return type:

None

Parameters:

message – Text to render

warning(message)[source]

Render a message with a yellow color.

Return type:

None

Parameters:

message – Text to render

format_datetime(unformatted_date)[source]

Format a datetime string to a more human readable format.

Return type:

str

Parameters:

unformatted_date (str) – The unformatted date (usually, it is datetime.now())

Returns:

The formatted date in human readable time.

Return type:

str

human_readable_size(size)[source]

Converts a byte value to a human-readable format (KB, MB, GB).

Return type:

str

Parameters:

size (float) – The size to be converted to a human readable format

Returns:

Size in a human readable format

Return type:

str