Skip to content

the problem with the log color using the coloring function #1205

Open
@1liochka1

Description

@1liochka1
class Color(Enum):
    scarlet = "scarlet"
    pink = "pink"
    orange = "orange"
    blue = "blue"
    purple = "purple"


from colorama import init, Fore, Style
init()

def colorize(color: Color, text: str) -> str:
    match color:
        case Color.scarlet:
            return f"{Fore.RED}{text}{Style.RESET_ALL}"
        case Color.pink:
            return f"{Fore.MAGENTA}{text}{Style.RESET_ALL}"
        case Color.blue:
            return f"{Fore.CYAN}{text}{Style.RESET_ALL}"
        case Color.orange:
            return f"{Fore.YELLOW}{text}{Style.RESET_ALL}"
        case _:
            return f"{Fore.MAGENTA}{text}{Style.RESET_ALL}"

logger.info(f'111111111111111   {colorize(Color.orange, "2222222222222")}    11111111111111111111')

hi, I'm trying to write a part of a function that will color some phrases of my blog and for some reason, when using this function, all the text that comes after using this coloring turns red. Can you help me? thanks

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions