Skip to content

rich_console

Rich console utilities.

This module contains classes and functions that OM uses to improve and augment its terminal console output, using the Rich python library.

get_current_timestamp()

Gets the current timestamp formatted for console output.

This function returns the current timestamp, with seconds precision, formatted in a style that is fit to be printed in the rich console.

Returns:

Type Description
str

A string with the formatted timestamp.

set_null_theme()

Configures OM's rich console not to use colors.

This function configures OM's rich console to use an null theme, effectively preventing it from using colors when displaying its output.

set_custom_theme(*, theme_dict)

Sets a custom theme for OM's rich console.

This function configures OM's rich console to use a custom theme. A dictionary passed to this function as an input parameter must stores the theme definition, using the syntax adopted by the python [Rich library][https://rich.readthedocs.io/en/stable/style.html]. The custom theme is applied on top of OM's base rich console's theme: the console will fall back to the base theme for any entry not defined in the dictionary passed to this function.

Parameters:

Name Type Description Default
theme_dict Dict[str, str]

A dictionary storing the custom theme definition, following the syntax defined by python Rich library.

required