DEV Community

Cover image for ๐ŸŽจ Add Colors to Your Python Code with Colorama! ๐Ÿโœจ
Developer
Developer

Posted on

๐ŸŽจ Add Colors to Your Python Code with Colorama! ๐Ÿโœจ

Is your CLI output looking dull?

Time to Colorama-fy it! ๐ŸŽ‰


๐Ÿ’ก Why Use Colorama?

  • โœ… Easy cross-platform terminal color support
  • ๐Ÿง  Great for debugging, logging, and catching the eye
  • ๐Ÿ”ง Simple syntax for styling output

๐Ÿš€ How to Use

from colorama import init, Fore, Style
init()

print(Fore.RED + Style.BRIGHT + "๐Ÿ”ฅ Error Detected!")
print(Fore.GREEN + "โœ… Success!")
print(Fore.YELLOW + Style.DIM + "โš ๏ธ Warning: Proceed with Caution")
Enter fullscreen mode Exit fullscreen mode

๐ŸŽฏ Key Features:

Fore.RED, Fore.GREEN, Fore.YELLOW, etc.

Style.BRIGHT, Style.DIM, Style.NORMAL

Back.COLORNAME for background colors

โšก Tip: Use init(autoreset=True) to avoid manually resetting styles!


๐Ÿ’ฌ Whether you're making a CLI app, logger, or just want prettier outputs,
Colorama adds life to your terminal! ๐ŸŽจ๐Ÿ–ฅ๏ธ

Top comments (0)