Skip to content

Добавить цвета в текстовый режим #50

@Former

Description

@Former

Пример

def colored_text(txt_msg, red_front, green_front, blue_front, red_back, green_back, blue_back):
    format = '\33[38;2;' + str(red_front) + ';' + str(green_front) + ';' + str(blue_front) + ';48;2;' + str(red_back) + ';' + str(green_back) + ';' + str(blue_back) + 'm'
    end = '\33[0m'
    return format + txt_msg + end

print(colored_text("test ", 255, 255, 255, 0, 255, 0) + ' ' + colored_text("test", 255, 0, 0, 0, 0, 255))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions