colorstr
-
Description: This function is used to convert Python objects into colored strings.
-
Parameters:
- obj (
Any
): Python object to be converted into a colored string. - color (
Union[COLORSTR, int, str]
): Color of the object. Default isCOLORSTR.BLUE
. - fmt (
Union[FORMATSTR, int, str]
): Format of the object. Default isFORMATSTR.BOLD
.
- obj (
-
Returns:
- str: Colored string.
-
Example:
import docsaidkit as D
# Print blue color string
blue_str = D.colorstr('This is blue color string.', color='blue')
print(blue_str)
# Print red color string with bold format
red_str = D.colorstr('This is red color string with bold format.', color='red', fmt='bold')
print(red_str)