DEV Community

Cover image for 🎨 Add Colors to Your Python Code with Colorama! 🐍✨
~ Umair Shakoor
~ Umair Shakoor

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)