From 32efccbd603f2f7e67de063e48421248e4810ba9 Mon Sep 17 00:00:00 2001 From: Faraphel Date: Sat, 20 Aug 2022 18:11:45 +0200 Subject: [PATCH] added @ operator shortcut for MKWColor to color a text --- source/mkw/collection/MKWColor.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/mkw/collection/MKWColor.py b/source/mkw/collection/MKWColor.py index e7b8b48..383cb94 100644 --- a/source/mkw/collection/MKWColor.py +++ b/source/mkw/collection/MKWColor.py @@ -42,6 +42,9 @@ class MKWColor: """ return f'{self.raw}{text}{get(bmg="off").raw}' + def __matmul__(self, other: str) -> str: # the operator @. Example : MKWColor.get(bmg="white") @ "text_to_color" + return self.color_text(other) + all_colors: list[MKWColor] = [ MKWColor(bmg="white", hexadecimal=0xFFFFFF, name="white"),