From ef266f4a17736dccb1bffefcd71a119936df1503 Mon Sep 17 00:00:00 2001 From: ninemine <1371605831@qq.com> Date: Tue, 21 Oct 2025 09:40:22 +0800 Subject: [PATCH] =?UTF-8?q?PrintColorful=E5=A2=9E=E5=BC=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Convention/Runtime/Config.py | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/Convention/Runtime/Config.py b/Convention/Runtime/Config.py index 022af40..e7c379f 100644 --- a/Convention/Runtime/Config.py +++ b/Convention/Runtime/Config.py @@ -110,6 +110,26 @@ class ConsoleStyleClass(AnsiCodes): ConsoleStyle = ConsoleStyleClass() +def PrintColorful(color:str, *args, is_reset:bool=True, **kwargs): + with lock_guard(): + if is_reset: + print(color,*args,ConsoleStyle.RESET_ALL, **kwargs) + else: + print(color,*args, **kwargs) + +def PrintAsError(message:str): + PrintColorful(ConsoleFrontColor.RED, message) +def PrintAsWarning(message:str): + PrintColorful(ConsoleFrontColor.YELLOW, message) +def PrintAsInfo(message:str): + PrintColorful(ConsoleFrontColor.GREEN, message) +def PrintAsDebug(message:str): + PrintColorful(ConsoleFrontColor.BLUE, message) +def PrintAsSuccess(message:str): + PrintColorful(ConsoleFrontColor.GREEN, message) +def PrintAsLight(message:str): + PrintColorful(ConsoleFrontColor.LIGHTMAGENTA_EX, message) + # endregion class NotImplementedError(Exception): @@ -137,13 +157,6 @@ def GetInternalDebug() -> bool: global INTERNAL_DEBUG return INTERNAL_DEBUG -def PrintColorful(color:str, *args, is_reset:bool=True, **kwargs): - with lock_guard(): - if is_reset: - print(color,*args,ConsoleStyle.RESET_ALL, **kwargs) - else: - print(color,*args, **kwargs) - ImportingFailedSet:Set[str] = set() def ImportingThrow( ex: ImportError,