Commit bb74c620 authored by Adrian DC's avatar Adrian DC
Browse files

fix(colors): add 'strip' with 'BOLD' and 'RESET' colors last

Signed-off-by: default avatarAdrian DC <radian.dc@gmail.com>
parent 06b83123
Loading
Loading
Loading
Loading
+13 −2
Changes for src/prints/colors.py: 13 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -57,17 +57,17 @@ class Colors:
            Colors.YELLOW_LIGHT = Colors.BOLD + Colored('light_yellow').foreground()
            Colors.YELLOW_THIN = Colors.RESET + Colored('yellow').foreground()
            Colors.ALL = [
                Colors.BOLD,
                Colors.CYAN,
                Colors.GREEN,
                Colors.GREEN_THIN,
                Colors.GREY,
                Colors.RED,
                Colors.RED_THIN,
                Colors.RESET,
                Colors.YELLOW,
                Colors.YELLOW_LIGHT,
                Colors.YELLOW_THIN,
                Colors.BOLD,
                Colors.RESET,
            ]

        # Colors disabled
@@ -84,3 +84,14 @@ class Colors:
            Colors.YELLOW_LIGHT = ''
            Colors.YELLOW_THIN = ''
            Colors.ALL = []

    # Strip
    @staticmethod
    def strip(string: str) -> str:

        # Strip all colors
        for item in Colors.ALL:
            string = string.replace(item, '')

        # Result
        return string