{"id":21240,"date":"2022-03-25T19:26:06","date_gmt":"2022-03-25T13:56:06","guid":{"rendered":"http:\/\/www.pythonpool.com\/?p=21240"},"modified":"2026-07-13T12:39:21","modified_gmt":"2026-07-13T07:09:21","slug":"python-colorama","status":"publish","type":"post","link":"https:\/\/www.pythonpool.com\/python-colorama\/","title":{"rendered":"Colorama in Python: ANSI Colors on Windows, macOS, and Linux"},"content":{"rendered":"<p><strong>Quick answer:<\/strong> Colorama makes ANSI terminal colors work across platforms, especially Windows. For current releases, call <code>just_fix_windows_console()<\/code> for the narrow compatibility fix, then use <code>Fore<\/code>, <code>Back<\/code>, and <code>Style<\/code> constants for output.<\/p>\n<figure class=\"pythonpool-article-visual\"><img src=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2026\/07\/python-colorama-terminal-pipeline.png\" alt=\"Colorama terminal diagram showing console initialization, ANSI styles, resets, and output policies for logs and automation\" width=\"1536\" height=\"1024\" loading=\"lazy\" decoding=\"async\"><figcaption>Initialize terminal support once, reset styles at message boundaries, and keep redirected logs readable as plain text.<\/figcaption><\/figure>\n<p><code>Colorama<\/code> is a small Python package for printing ANSI-colored terminal text in a way that works well on Windows, macOS, and Linux. It is useful for command-line tools, status messages, simple reports, and local debugging output.<\/p>\n<p>The core references are the <a href=\"https:\/\/pypi.org\/project\/colorama\/\">Colorama package page<\/a> and the <a href=\"https:\/\/github.com\/tartley\/colorama\">Colorama GitHub repository<\/a>.<\/p>\n<p>Colorama exposes foreground colors through <code>Fore<\/code>, background colors through <code>Back<\/code>, and text styles through <code>Style<\/code>. The most important habit is resetting styles after colored output so later terminal text does not inherit the same color.<\/p>\n<p>Install it into the same environment that runs your script, usually with <code>python -m pip install colorama<\/code>. If a command works in one terminal but fails in another, check the interpreter and environment before changing the code.<\/p>\n<p>Color should improve scanning, not decorate every line. Reserve it for state changes, warnings, errors, and short summaries. Plain text should still be complete enough for copy-paste, search, and saved logs.<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_85 counter-hierarchy ez-toc-counter ez-toc-transparent ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #990303;color:#990303\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #990303;color:#990303\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 eztoc-toggle-hide-by-default' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.pythonpool.com\/python-colorama\/#Initialize_Colorama\" >Initialize Colorama<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.pythonpool.com\/python-colorama\/#Use_Foreground_Colors\" >Use Foreground Colors<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.pythonpool.com\/python-colorama\/#Add_Background_Colors_And_Styles\" >Add Background Colors And Styles<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.pythonpool.com\/python-colorama\/#Create_A_Status_Formatter\" >Create A Status Formatter<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.pythonpool.com\/python-colorama\/#Strip_ANSI_Codes_When_Needed\" >Strip ANSI Codes When Needed<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.pythonpool.com\/python-colorama\/#Use_Colorama_With_Logging\" >Use Colorama With Logging<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.pythonpool.com\/python-colorama\/#Prefer_just_fix_windows_console\" >Prefer just_fix_windows_console()<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.pythonpool.com\/python-colorama\/#Handle_redirected_output\" >Handle redirected output<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.pythonpool.com\/python-colorama\/#Test_terminal_formatting_separately\" >Test terminal formatting separately<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/www.pythonpool.com\/python-colorama\/#Frequently_Asked_Questions\" >Frequently Asked Questions<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/www.pythonpool.com\/python-colorama\/#What_is_Colorama_used_for_in_Python\" >What is Colorama used for in Python?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/www.pythonpool.com\/python-colorama\/#What_should_I_call_to_initialize_Colorama\" >What should I call to initialize Colorama?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/www.pythonpool.com\/python-colorama\/#How_do_I_reset_Colorama_colors\" >How do I reset Colorama colors?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/www.pythonpool.com\/python-colorama\/#Should_colored_escape_codes_be_written_to_log_files\" >Should colored escape codes be written to log files?<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"Initialize_Colorama\"><\/span>Initialize Colorama<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>On current Windows terminals, ANSI color support is often available already. <code>just_fix_windows_console()<\/code> is a safe helper that enables support when needed and does nothing harmful on other platforms.<\/p>\n<pre><code class=\"language-python\">from colorama import Fore, Style, just_fix_windows_console\n\njust_fix_windows_console()\n\nprint(Fore.GREEN + \"Build passed\" + Style.RESET_ALL)\nprint(Fore.RED + \"Build failed\" + Style.RESET_ALL)\n<\/code><\/pre>\n<p>This is usually enough for scripts that print status lines. The reset call returns the terminal to its normal appearance after each message.<\/p>\n<p>If your output is captured by a file or CI log, test how that environment displays ANSI sequences. Some systems preserve colors, while others show the escape codes as text.<\/p>\n<p>For reusable packages, avoid enabling colors at import time. Initialize console behavior inside the command-line entry point so importing the package does not unexpectedly change another program&#8217;s output.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Use_Foreground_Colors\"><\/span>Use Foreground Colors<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Foreground colors change the text color. Keep the palette meaningful: green for success, yellow for warnings, red for errors, and cyan or blue for informational messages.<\/p>\n<pre><code class=\"language-python\">from colorama import Fore, Style, just_fix_windows_console\n\njust_fix_windows_console()\n\nmessages = [\n    (Fore.CYAN, \"INFO\", \"Reading configuration\"),\n    (Fore.YELLOW, \"WARN\", \"Using default timeout\"),\n    (Fore.RED, \"ERROR\", \"Connection failed\"),\n]\n\nfor color, label, text in messages:\n    print(color + f\"{label}: {text}\" + Style.RESET_ALL)\n<\/code><\/pre>\n<p>Do not use color as the only signal. Labels such as <code>INFO<\/code>, <code>WARN<\/code>, and <code>ERROR<\/code> keep the output understandable in plain text logs.<\/p>\n<p>This matters for accessibility, log search, and terminals that do not render colors consistently.<\/p>\n<p>A small, consistent vocabulary also helps teammates understand the output quickly. Do not assign the same color to both success and warning states.<\/p>\n<p><!-- Python Pool visual layout repair 2026-07-13 --><\/p>\n<figure class=\"pythonpool-article-visual pythonpool-supporting-visual\"><img src=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2026\/07\/colorama-terminal-b186.png\" alt=\"Python Pool infographic showing Python terminal text, ANSI escape sequences, and Colorama\" width=\"1536\" height=\"1054\" loading=\"lazy\" decoding=\"async\"><figcaption>Terminal output: Python terminal text, ANSI escape sequences, and Colorama.<\/figcaption><\/figure>\n<h2><span class=\"ez-toc-section\" id=\"Add_Background_Colors_And_Styles\"><\/span>Add Background Colors And Styles<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><code>Back<\/code> controls the background color, and <code>Style<\/code> can brighten or dim text. Use these sparingly because strong background colors can make terminal output harder to scan.<\/p>\n<pre><code class=\"language-python\">from colorama import Back, Fore, Style, just_fix_windows_console\n\njust_fix_windows_console()\n\nbanner = Back.BLUE + Fore.WHITE + Style.BRIGHT\nprint(banner + \" DEPLOYMENT STARTED \" + Style.RESET_ALL)\n\nnormal = Fore.WHITE + \"Processing files...\"\nprint(normal + Style.RESET_ALL)\n<\/code><\/pre>\n<p>Background colors are best for short banners, selected rows, or urgent status labels. Long colored blocks usually make command output noisy.<\/p>\n<p>Always add <code>Style.RESET_ALL<\/code> at the end of a styled segment. It protects the next line, prompt, or command output from accidental carryover.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Create_A_Status_Formatter\"><\/span>Create A Status Formatter<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>A small formatter keeps color choices in one place and prevents repeated string concatenation throughout a script.<\/p>\n<pre><code class=\"language-python\">from colorama import Fore, Style, just_fix_windows_console\n\njust_fix_windows_console()\n\nSTATUS_COLORS = {\n    \"ok\": Fore.GREEN,\n    \"warning\": Fore.YELLOW,\n    \"error\": Fore.RED,\n}\n\ndef format_status(level, message):\n    color = STATUS_COLORS.get(level, Fore.WHITE)\n    return f\"{color}{level.upper()}: {message}{Style.RESET_ALL}\"\n\nprint(format_status(\"ok\", \"cache refreshed\"))\nprint(format_status(\"warning\", \"retry scheduled\"))\n<\/code><\/pre>\n<p>This approach scales better than placing raw color constants beside every print call. It also makes it easy to disable or change colors later.<\/p>\n<p>For command-line tools, consider adding a <code>--no-color<\/code> option when output may be piped into another command.<\/p>\n<p>You can also decide automatically based on whether the stream is attached to a terminal. That keeps human output colorful while keeping redirected output plain.<\/p>\n<figure class=\"pythonpool-article-visual pythonpool-supporting-visual\"><img src=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2026\/07\/colorama-init-b186.png\" alt=\"Python Pool infographic mapping colorama init autoreset and conversion to platform terminal behavior\" width=\"1536\" height=\"1054\" loading=\"lazy\" decoding=\"async\"><figcaption>Initialize: Colorama init autoreset and conversion to platform terminal behavior.<\/figcaption><\/figure>\n<h2><span class=\"ez-toc-section\" id=\"Strip_ANSI_Codes_When_Needed\"><\/span>Strip ANSI Codes When Needed<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>When colored output is stored in a plain text file, you may want to remove ANSI escape sequences before saving or comparing logs.<\/p>\n<pre><code class=\"language-python\">import re\nfrom colorama import Fore, Style\n\nansi_pattern = re.compile(r\"\\x1b\\[[0-9;]*m\")\n\ncolored = Fore.GREEN + \"OK: finished\" + Style.RESET_ALL\nplain = ansi_pattern.sub(\"\", colored)\n\nprint(colored)\nprint(plain)\n<\/code><\/pre>\n<p>This is useful in tests that compare output. The user sees color in the terminal, while assertions can compare stable plain text.<\/p>\n<p>Keep the stripping logic close to file writing or testing code. Application code should usually create clear messages first and color them at the edge.<\/p>\n<figure class=\"pythonpool-article-visual pythonpool-supporting-visual\"><img src=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2026\/07\/colorama-style-b186.png\" alt=\"Python Pool infographic comparing Fore, Back, Style, reset, and formatted terminal output\" width=\"1536\" height=\"1054\" loading=\"lazy\" decoding=\"async\"><figcaption>Colors and styles: Fore, Back, Style, reset, and formatted terminal output.<\/figcaption><\/figure>\n<h2><span class=\"ez-toc-section\" id=\"Use_Colorama_With_Logging\"><\/span>Use Colorama With Logging<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Colorama can also help format console logs. Keep file logs uncolored and color only the stream shown to a human.<\/p>\n<pre><code class=\"language-python\">import logging\nfrom colorama import Fore, Style, just_fix_windows_console\n\njust_fix_windows_console()\n\nLEVEL_COLORS = {\n    logging.INFO: Fore.CYAN,\n    logging.WARNING: Fore.YELLOW,\n    logging.ERROR: Fore.RED,\n}\n\nclass ColorFormatter(logging.Formatter):\n    def format(self, record):\n        color = LEVEL_COLORS.get(record.levelno, \"\")\n        message = super().format(record)\n        return color + message + Style.RESET_ALL\n\nhandler = logging.StreamHandler()\nhandler.setFormatter(ColorFormatter(\"%(levelname)s: %(message)s\"))\n\nlogger = logging.getLogger(\"demo\")\nlogger.addHandler(handler)\nlogger.setLevel(logging.INFO)\nlogger.warning(\"Disk space is low\")\n<\/code><\/pre>\n<p>For richer terminal formatting, compare Colorama with <a href=\"https:\/\/pypi.org\/project\/termcolor\/\">termcolor<\/a> or a full terminal UI library. Colorama is best when you need lightweight color support without changing the rest of your command-line program.<\/p>\n<p>The practical pattern is to initialize console support, choose a small color vocabulary, include readable text labels, reset after each styled segment, and keep saved logs free of escape sequences.<\/p>\n<p>When in doubt, test the command in the terminals your users actually use. Windows Terminal, PowerShell, macOS Terminal, Linux shells, and CI viewers can all differ slightly in how they present ANSI styling.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Prefer_just_fix_windows_console\"><\/span>Prefer just_fix_windows_console()<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><code>just_fix_windows_console()<\/code> is safe to call more than once and does nothing on platforms that already handle ANSI sequences. It is the focused choice when an application only needs colored terminal output to work on Windows.<\/p>\n<pre><code class=\"language-python\">from colorama import Fore, Style, just_fix_windows_console\n\njust_fix_windows_console()\nprint(Fore.GREEN + \"ready\" + Style.RESET_ALL)\n<\/code><\/pre>\n<p>The older <code>init()<\/code> interface remains useful for options such as <code>autoreset<\/code>, but repeated calls can wrap standard streams more than once. Keep initialization in one application entry point.<\/p>\n<figure class=\"pythonpool-article-visual pythonpool-supporting-visual\"><img src=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2026\/07\/colorama-check-b186.png\" alt=\"Python Pool infographic testing Windows, macOS, Linux, Unicode, cleanup, and validation\" width=\"1536\" height=\"1054\" loading=\"lazy\" decoding=\"async\"><figcaption>Terminal checks: Windows, macOS, Linux, Unicode, cleanup, and validation.<\/figcaption><\/figure>\n<h2><span class=\"ez-toc-section\" id=\"Handle_redirected_output\"><\/span>Handle redirected output<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Terminals, files, CI logs, and test capture tools do not all support ANSI color. A robust application should also consider a color option or a TTY check. Keep machine-readable output free of escape codes and route diagnostics through <a href=\"https:\/\/www.pythonpool.com\/python-logging\/\">Python logging<\/a> or <a href=\"1\">stderr<\/a>.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Test_terminal_formatting_separately\"><\/span>Test terminal formatting separately<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Tests should assert the message meaning separately from terminal decoration. Capture plain output when possible, test initialization on the target platform, and verify that secrets are never colored or written into logs. Call <code>deinit()<\/code> only when a long-running process must restore the original streams.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Frequently_Asked_Questions\"><\/span>Frequently Asked Questions<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><span class=\"ez-toc-section\" id=\"What_is_Colorama_used_for_in_Python\"><\/span>What is Colorama used for in Python?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Colorama makes ANSI terminal styling practical across platforms, including Windows consoles that need compatibility handling.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"What_should_I_call_to_initialize_Colorama\"><\/span>What should I call to initialize Colorama?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Use just_fix_windows_console() at the command-line entry point when you need portable Windows ANSI support; it is safe on other platforms.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"How_do_I_reset_Colorama_colors\"><\/span>How do I reset Colorama colors?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Append Style.RESET_ALL after a styled message so later terminal output does not inherit the previous foreground, background, or text style.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Should_colored_escape_codes_be_written_to_log_files\"><\/span>Should colored escape codes be written to log files?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Usually no. Detect whether output is an interactive terminal and keep redirected files, machine output, and CI logs free of unwanted ANSI sequences.<\/p>\n<p><script type=\"application\/ld+json\">{\"@context\":\"https:\/\/schema.org\",\"@type\":\"FAQPage\",\"mainEntity\":[{\"@type\":\"Question\",\"name\":\"What is Colorama used for in Python?\",\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"Colorama makes ANSI terminal styling practical across platforms, including Windows consoles that need compatibility handling.\"}},{\"@type\":\"Question\",\"name\":\"What should I call to initialize Colorama?\",\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"Use just_fix_windows_console() at the command-line entry point when you need portable Windows ANSI support; it is safe on other platforms.\"}},{\"@type\":\"Question\",\"name\":\"How do I reset Colorama colors?\",\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"Append Style.RESET_ALL after a styled message so later terminal output does not inherit the previous foreground, background, or text style.\"}},{\"@type\":\"Question\",\"name\":\"Should colored escape codes be written to log files?\",\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"Usually no. Detect whether output is an interactive terminal and keep redirected files, machine output, and CI logs free of unwanted ANSI sequences.\"}}]}<\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Add portable terminal colors with Colorama while keeping status messages readable in terminals, CI logs, and redirected output.<\/p>\n","protected":false},"author":28,"featured_media":33782,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[4345],"tags":[5058,5056,5057,5053,5059,5054,5055,5052],"class_list":["post-21240","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-module","tag-colorama-python-github","tag-download-colorama-python","tag-how-to-install-colorama-in-python-3","tag-how-to-use-colorama-in-python","tag-install-colorama-python-windows","tag-python-colorama-bold","tag-python-colorama-example","tag-python-pip-install-colorama","infinite-scroll-item"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v20.1 (Yoast SEO v28.0) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Colorama in Python: ANSI Colors on Windows, macOS, and Linux<\/title>\n<meta name=\"description\" content=\"Use Colorama for portable terminal colors with just_fix_windows_console(), Fore, Back, Style, resets, logging, and redirected output.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.pythonpool.com\/python-colorama\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Colorama in Python: ANSI Colors on Windows, macOS, and Linux\" \/>\n<meta property=\"og:description\" content=\"Add portable terminal colors with Colorama while keeping status messages readable in terminals, CI logs, and redirected output.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pythonpool.com\/python-colorama\/\" \/>\n<meta property=\"og:site_name\" content=\"Python Pool\" \/>\n<meta property=\"article:published_time\" content=\"2022-03-25T13:56:06+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-07-13T07:09:21+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2026\/07\/python-colorama-terminal-pipeline.png\" \/>\n<meta name=\"author\" content=\"Vishnu Venkatesh\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"Python Pool\" \/>\n<meta name=\"twitter:description\" content=\"Practical Python tutorials, error fixes, code examples, and project guides.\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2026\/07\/python-colorama-terminal-pipeline.png\" \/>\n<meta name=\"twitter:creator\" content=\"@pythonpool\" \/>\n<meta name=\"twitter:site\" content=\"@pythonpool\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Vishnu Venkatesh\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.pythonpool.com\\\/python-colorama\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pythonpool.com\\\/python-colorama\\\/\"},\"author\":{\"name\":\"Vishnu Venkatesh\",\"@id\":\"https:\\\/\\\/www.pythonpool.com\\\/#\\\/schema\\\/person\\\/5e8aa48e7557450d345c829305550688\"},\"headline\":\"Colorama in Python: ANSI Colors on Windows, macOS, and Linux\",\"datePublished\":\"2022-03-25T13:56:06+00:00\",\"dateModified\":\"2026-07-13T07:09:21+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.pythonpool.com\\\/python-colorama\\\/\"},\"wordCount\":1055,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.pythonpool.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.pythonpool.com\\\/python-colorama\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.pythonpool.com\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/python-colorama-console-colors-guide-pythonpool.png\",\"keywords\":[\"colorama python github\",\"download colorama python\",\"how to install colorama in python 3\",\"how to use colorama in python\",\"install colorama python windows\",\"python colorama bold\",\"python colorama example\",\"python pip install colorama\"],\"articleSection\":[\"Module\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.pythonpool.com\\\/python-colorama\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.pythonpool.com\\\/python-colorama\\\/\",\"url\":\"https:\\\/\\\/www.pythonpool.com\\\/python-colorama\\\/\",\"name\":\"Colorama in Python: ANSI Colors on Windows, macOS, and Linux\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pythonpool.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.pythonpool.com\\\/python-colorama\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.pythonpool.com\\\/python-colorama\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.pythonpool.com\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/python-colorama-console-colors-guide-pythonpool.png\",\"datePublished\":\"2022-03-25T13:56:06+00:00\",\"dateModified\":\"2026-07-13T07:09:21+00:00\",\"description\":\"Use Colorama for portable terminal colors with just_fix_windows_console(), Fore, Back, Style, resets, logging, and redirected output.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.pythonpool.com\\\/python-colorama\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.pythonpool.com\\\/python-colorama\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.pythonpool.com\\\/python-colorama\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.pythonpool.com\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/python-colorama-console-colors-guide-pythonpool.png\",\"contentUrl\":\"https:\\\/\\\/www.pythonpool.com\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/python-colorama-console-colors-guide-pythonpool.png\",\"width\":1350,\"height\":650,\"caption\":\"Python Colorama console colors guide\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.pythonpool.com\\\/python-colorama\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.pythonpool.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Colorama in Python: ANSI Colors on Windows, macOS, and Linux\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.pythonpool.com\\\/#website\",\"url\":\"https:\\\/\\\/www.pythonpool.com\\\/\",\"name\":\"Python Pool\",\"description\":\"Practical Python tutorials, error fixes, code examples, and project guides.\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.pythonpool.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.pythonpool.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.pythonpool.com\\\/#organization\",\"name\":\"Python Pool\",\"url\":\"https:\\\/\\\/www.pythonpool.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.pythonpool.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.pythonpool.com\\\/wp-content\\\/uploads\\\/2020\\\/08\\\/aa.png\",\"contentUrl\":\"https:\\\/\\\/www.pythonpool.com\\\/wp-content\\\/uploads\\\/2020\\\/08\\\/aa.png\",\"width\":452,\"height\":185,\"caption\":\"Python Pool\"},\"image\":{\"@id\":\"https:\\\/\\\/www.pythonpool.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/x.com\\\/pythonpool\",\"https:\\\/\\\/www.youtube.com\\\/c\\\/pythonpool\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.pythonpool.com\\\/#\\\/schema\\\/person\\\/5e8aa48e7557450d345c829305550688\",\"name\":\"Vishnu Venkatesh\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8d399a4488a19871b08a11ebd884e233b04c76d12edc4c7278a79d69df853d75?s=96&d=wavatar&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8d399a4488a19871b08a11ebd884e233b04c76d12edc4c7278a79d69df853d75?s=96&d=wavatar&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8d399a4488a19871b08a11ebd884e233b04c76d12edc4c7278a79d69df853d75?s=96&d=wavatar&r=g\",\"caption\":\"Vishnu Venkatesh\"}}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Colorama in Python: ANSI Colors on Windows, macOS, and Linux","description":"Use Colorama for portable terminal colors with just_fix_windows_console(), Fore, Back, Style, resets, logging, and redirected output.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.pythonpool.com\/python-colorama\/","og_locale":"en_US","og_type":"article","og_title":"Colorama in Python: ANSI Colors on Windows, macOS, and Linux","og_description":"Add portable terminal colors with Colorama while keeping status messages readable in terminals, CI logs, and redirected output.","og_url":"https:\/\/www.pythonpool.com\/python-colorama\/","og_site_name":"Python Pool","article_published_time":"2022-03-25T13:56:06+00:00","article_modified_time":"2026-07-13T07:09:21+00:00","og_image":[{"url":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2026\/07\/python-colorama-terminal-pipeline.png","type":"","width":"","height":""}],"author":"Vishnu Venkatesh","twitter_card":"summary_large_image","twitter_title":"Python Pool","twitter_description":"Practical Python tutorials, error fixes, code examples, and project guides.","twitter_image":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2026\/07\/python-colorama-terminal-pipeline.png","twitter_creator":"@pythonpool","twitter_site":"@pythonpool","twitter_misc":{"Written by":"Vishnu Venkatesh","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.pythonpool.com\/python-colorama\/#article","isPartOf":{"@id":"https:\/\/www.pythonpool.com\/python-colorama\/"},"author":{"name":"Vishnu Venkatesh","@id":"https:\/\/www.pythonpool.com\/#\/schema\/person\/5e8aa48e7557450d345c829305550688"},"headline":"Colorama in Python: ANSI Colors on Windows, macOS, and Linux","datePublished":"2022-03-25T13:56:06+00:00","dateModified":"2026-07-13T07:09:21+00:00","mainEntityOfPage":{"@id":"https:\/\/www.pythonpool.com\/python-colorama\/"},"wordCount":1055,"commentCount":0,"publisher":{"@id":"https:\/\/www.pythonpool.com\/#organization"},"image":{"@id":"https:\/\/www.pythonpool.com\/python-colorama\/#primaryimage"},"thumbnailUrl":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2026\/07\/python-colorama-console-colors-guide-pythonpool.png","keywords":["colorama python github","download colorama python","how to install colorama in python 3","how to use colorama in python","install colorama python windows","python colorama bold","python colorama example","python pip install colorama"],"articleSection":["Module"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.pythonpool.com\/python-colorama\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.pythonpool.com\/python-colorama\/","url":"https:\/\/www.pythonpool.com\/python-colorama\/","name":"Colorama in Python: ANSI Colors on Windows, macOS, and Linux","isPartOf":{"@id":"https:\/\/www.pythonpool.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.pythonpool.com\/python-colorama\/#primaryimage"},"image":{"@id":"https:\/\/www.pythonpool.com\/python-colorama\/#primaryimage"},"thumbnailUrl":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2026\/07\/python-colorama-console-colors-guide-pythonpool.png","datePublished":"2022-03-25T13:56:06+00:00","dateModified":"2026-07-13T07:09:21+00:00","description":"Use Colorama for portable terminal colors with just_fix_windows_console(), Fore, Back, Style, resets, logging, and redirected output.","breadcrumb":{"@id":"https:\/\/www.pythonpool.com\/python-colorama\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pythonpool.com\/python-colorama\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pythonpool.com\/python-colorama\/#primaryimage","url":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2026\/07\/python-colorama-console-colors-guide-pythonpool.png","contentUrl":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2026\/07\/python-colorama-console-colors-guide-pythonpool.png","width":1350,"height":650,"caption":"Python Colorama console colors guide"},{"@type":"BreadcrumbList","@id":"https:\/\/www.pythonpool.com\/python-colorama\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.pythonpool.com\/"},{"@type":"ListItem","position":2,"name":"Colorama in Python: ANSI Colors on Windows, macOS, and Linux"}]},{"@type":"WebSite","@id":"https:\/\/www.pythonpool.com\/#website","url":"https:\/\/www.pythonpool.com\/","name":"Python Pool","description":"Practical Python tutorials, error fixes, code examples, and project guides.","publisher":{"@id":"https:\/\/www.pythonpool.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.pythonpool.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.pythonpool.com\/#organization","name":"Python Pool","url":"https:\/\/www.pythonpool.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pythonpool.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png","contentUrl":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png","width":452,"height":185,"caption":"Python Pool"},"image":{"@id":"https:\/\/www.pythonpool.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/pythonpool","https:\/\/www.youtube.com\/c\/pythonpool"]},{"@type":"Person","@id":"https:\/\/www.pythonpool.com\/#\/schema\/person\/5e8aa48e7557450d345c829305550688","name":"Vishnu Venkatesh","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/8d399a4488a19871b08a11ebd884e233b04c76d12edc4c7278a79d69df853d75?s=96&d=wavatar&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/8d399a4488a19871b08a11ebd884e233b04c76d12edc4c7278a79d69df853d75?s=96&d=wavatar&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/8d399a4488a19871b08a11ebd884e233b04c76d12edc4c7278a79d69df853d75?s=96&d=wavatar&r=g","caption":"Vishnu Venkatesh"}}]}},"_links":{"self":[{"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/21240","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/users\/28"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/comments?post=21240"}],"version-history":[{"count":60,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/21240\/revisions"}],"predecessor-version":[{"id":41851,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/21240\/revisions\/41851"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/media\/33782"}],"wp:attachment":[{"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/media?parent=21240"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/categories?post=21240"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/tags?post=21240"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}