Atlas - console.py
Home / npkg-testing / tools / npkg Lines: 1 | Size: 800 bytes [Download] [Show on GitHub] [Search similar files] [Raw] [Raw (proxy)][FILE BEGIN]1import os 2import sys 3 4 5RESET = "\033[0m" 6BOLD = "\033[1m" 7GREEN = "\033[32m" 8YELLOW = "\033[33m" 9RED = "\033[31m" 10BLUE = "\033[34m" 11 12 13def use_color() -> bool: 14 return sys.stdout.isatty() and os.environ.get("NO_COLOR") is None 15 16 17def style(text: str, color: str = "", bold: bool = False) -> str: 18 if not use_color(): 19 return text 20 prefix = "" 21 if bold: 22 prefix += BOLD 23 if color: 24 prefix += color 25 return f"{prefix}{text}{RESET}" 26 27 28def info(message: str) -> None: 29 print(f"[{style('>', BLUE)}] {message}") 30 31 32def ok(message: str) -> None: 33 print(f"[{style('+', GREEN)}] {message}") 34 35 36def warn(message: str) -> None: 37 print(f"[{style('!', YELLOW)}] {message}") 38 39 40def fail(message: str) -> None: 41 print(f"[{style('x', RED)}] {message}", file=sys.stderr) 42[FILE END](C) 2025 0x4248 (C) 2025 4248 Media and 4248 Systems, All part of 0x4248 See LICENCE files for more information. Not all files are by 0x4248 always check Licencing.