Colored messages

List of available functions

Example

Below is an example on how to generate colored texts.

from wilfried.utilities import coloredMessages as cmsg

bright = cmsg.brightMessage('A bright message !')
dim    = cmsg.dimMessage(   'A dim message !')
error  = cmsg.errorMessage( 'An error message !')
ok     = cmsg.okMessage(    'A message to say everything is fine !')

# Just print them one by one
for i in [bright, dim, error, ok]:
   print(i)

# You can also combine them together
print(bright, dim, 'A normal text in the middle.', error, ok)

Documentation

Code author: Wilfried Mercier - IRAP <wilfried.mercier@irap.omp.eu>

General functions to format io output using ANSII sequences using colorama.

utilities.coloredMessages.brightMessage(text)[source]

Code author: Wilfried Mercier - IRAP <wilfried.mercier@irap.omp.eu>

Emphasize a text by brightening it.

Parameters

text (str) – text

Returns

brightened text

Return type

str

utilities.coloredMessages.dimMessage(text)[source]

Code author: Wilfried Mercier - IRAP <wilfried.mercier@irap.omp.eu>

Dim a text.

Parameters

text (str) – text

Returns

dimmed text

Return type

str

utilities.coloredMessages.errorMessage(text)[source]

Code author: Wilfried Mercier - IRAP <wilfried.mercier@irap.omp.eu>

Colorise text in red and emphasise it for error messages.

Parameters

text (str) – text

Returns

colorised text

Return type

str

utilities.coloredMessages.okMessage(text)[source]

Code author: Wilfried Mercier - IRAP <wilfried.mercier@irap.omp.eu>

Dim green text for validation messages.

Parameters

text (str) – text

Returns

colorised text

Return type

str

utilities.coloredMessages.warningMessage(text)[source]

Code author: Wilfried Mercier - IRAP <wilfried.mercier@irap.omp.eu>

Same as error message but using yellow instead of red.

Parameters

text (str) – text

Returns

colorised text

Return type

str