diff --git a/README.md b/README.md index 6122044..c8650de 100644 --- a/README.md +++ b/README.md @@ -283,6 +283,28 @@ Clr.delPrevLine(5) > ``` > ###### Paint your letters in a repeating pattern, by specifying an unlimited amount of Clr codes! +
+ +#### :mirror: Clr.mirror() + + + +> ```python +> print( Clr.mirror(string) ) +> ``` +> ###### Upside down your string. + +
+ +#### 🔄 Clr.reverse() + + + +> ```python +> print( Clr.reverse(string) ) +> ``` +> ###### Flip and upside down your string. +


diff --git a/VividHues/__init__.py b/VividHues/__init__.py index 22864f9..f314427 100644 --- a/VividHues/__init__.py +++ b/VividHues/__init__.py @@ -36,7 +36,7 @@ def dunders() -> None: __homepage__ = "https://github.com/KennyOliver/VividHues" __package__ = "VividHues" __pypi__ = "https://pypi.org/project/VividHues/" -__version__ = "5.9.2" +__version__ = "5.10.2" class Clr: @@ -51,7 +51,7 @@ class Clr: LIME = "\033[92m" YELLOW = "\033[93m" PINK = "\033[95m" - + UNDERLINE = "\033[4m" UL = UNDERLINE BOLD = "\033[01m" @@ -59,11 +59,75 @@ class Clr: RESET = "\033[0m" RS = RESET - + MIRROR_DICT = { + "A": "Ɐ", + "B": "B", + "C": "C", + "D": "D", + "E": "E", + "F": "ᖶ", + "G": "ᘓ", + "H": "H", + "I": "I", + "J": "ᒉ", + "K": "K", + "L": "Γ", + "M": "W", + "N": "И", + "O": "O", + "P": "b", + "Q": "⥀", + "R": "ᖉ", + "S": "Ƨ", + "T": "ꓕ", + "U": "ꓵ", + "V": "Λ", + "W": "M", + "X": "X", + "Y": "⅄", + "Z": "Z", + "a": "ɐ", + "b": "q", + "c": "ɔ", + "d": "p", + "e": "ǝ", + "f": "ɟ", + "g": "ƃ", + "h": "ɥ", + "i": "ᴉ", + "j": "ɾ", + "k": "ʞ", + "l": "l", + "m": "ɯ", + "n": "u", + "o": "o", + "p": "d", + "q": "b", + "r": "ɹ", + "s": "s", + "t": "ʇ", + "u": "n", + "v": "ʌ", + "w": "ʍ", + "x": "x", + "y": "ʎ", + "z": "z", + "0": "0", + "1": "Ɩ", + "2": "ᄅ", + "3": "Ɛ", + "4": "ㄣ", + "5": "ϛ", + "6": "9", + "7": "ㄥ", + "8": "8", + "9": "6", + } + @classmethod def random_color(cls) -> str: """ returns a random Clr code """ - + colors = [] # List of all the colors in the class Clr for key in Clr.__dict__.keys(): if key == "UNDERLINE": # Once we got to UNDERLINE, there is no more color @@ -77,14 +141,14 @@ def random_color(cls) -> str: @classmethod def random(cls, string_to_color: str) -> str: """ chooses a random Clr code """ - + return f'{Clr.random_color()}' + string_to_color + Clr.RS @classmethod def jazzy(cls, string_to_color: str) -> str: """ gives each letter a random color """ - + jazzy_str = "" for letter in string_to_color: @@ -96,7 +160,7 @@ def jazzy(cls, string_to_color: str) -> str: @classmethod def rainbow(cls, string_to_color: str) -> str: """ colors each letter in a rainbow pattern """ - + rainbow_colors = [Clr.RED, Clr.ORANGE, Clr.YELLOW, Clr.GREEN, Clr.LIME, Clr.CYAN, Clr.BLUE, Clr.PURPLE, Clr.PINK] rainbow_str = "" @@ -109,9 +173,10 @@ def rainbow(cls, string_to_color: str) -> str: colors_index += 1 if colors_index == 9: colors_index = 0 - + return rainbow_str + Clr.RS - + + @classmethod def pattern(cls, string_to_color: str, *chosen_clrs) -> str: """ allow custom definitions of Clr patterns """ @@ -122,7 +187,7 @@ def pattern(cls, string_to_color: str, *chosen_clrs) -> str: + f"Expected some Clr codes, but was povided {len(chosen_clrs)}!" + Clr.RS ) - + pattern_str = "" string_index = 0 colors_index = 0 @@ -133,10 +198,34 @@ def pattern(cls, string_to_color: str, *chosen_clrs) -> str: string_index += 1 if colors_index == len(chosen_clrs): colors_index = 0 - + return pattern_str + Clr.RS - + + @classmethod + def mirror(cls, string_to_color: str) -> str: + """ flip all letters upside down """ + + mirror_str = "" + + for letter in string_to_color: + try: + mirror_str += Clr.MIRROR_DICT[letter] + except KeyError: + mirror_str += letter + + return mirror_str + + + @classmethod + def reverse(cls, string_to_color: str) -> str: + """ flip and reverse all letters upside down """ + + reverse_str = Clr.mirror(string_to_color)[::-1] + + return reverse_str + + def delPrevLine(repeat: int = 1) -> None: ''' erases the previous line in the CLI ''' @@ -148,7 +237,7 @@ def delPrevLine(repeat: int = 1) -> None: ) import sys - + CURSOR_UP_ONE = '\x1b[1A' ERASE_LINE = '\x1b[2K' for _ in range(int(repeat)): diff --git a/VividHues/__pycache__/__init__.cpython-312.pyc b/VividHues/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000..d9d4989 Binary files /dev/null and b/VividHues/__pycache__/__init__.cpython-312.pyc differ diff --git a/VividHues/__pycache__/__init__.cpython-39.pyc b/VividHues/__pycache__/__init__.cpython-39.pyc deleted file mode 100644 index 31f62a3..0000000 Binary files a/VividHues/__pycache__/__init__.cpython-39.pyc and /dev/null differ