{"id":9492,"library":"ascii-colors","title":"ASCII Colors","description":"A Python library for rich terminal output with advanced logging features. It provides functionalities for styling text, creating progress bars, and handling advanced terminal interactions. The current version is 0.11.21, with active development featuring regular updates.","status":"active","version":"0.11.21","language":"en","source_language":"en","source_url":"https://github.com/ParisNeo/ascii_colors","tags":["terminal","cli","colors","logging","ui","ascii-art","rich-output"],"install":[{"cmd":"pip install ascii-colors","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Required for some advanced features, particularly syntax highlighting and some ASCII art rendering.","package":"Pygments","optional":false}],"imports":[{"note":"The library is commonly imported with an alias 'ac' for brevity when accessing its functions and color attributes.","symbol":"ascii_colors","correct":"import ascii_colors as ac"},{"note":"The main class, though many common color functions are directly available from the module.","symbol":"ASCIIColors","correct":"from ascii_colors import ASCIIColors"}],"quickstart":{"code":"import ascii_colors as ac\n\n# Basic text coloring\nprint(ac.red(\"This is red text.\"))\nprint(ac.green(\"This is green text.\"))\n\n# Chaining styles (e.g., bold and blue)\nprint(ac.bold + ac.blue(\"Bold blue text.\") + ac.reset)\n\n# Background and foreground colors\nprint(ac.bg_yellow + ac.black(\"Black text on a yellow background.\") + ac.reset)\n\n# Using the advanced logging features\nac.log_info(\"This is an informational message.\")\nac.log_warning(\"This is a warning message.\")\nac.log_error(\"This is an error message.\")\n\n# Example of ASCII art (requires Pygments for complex fonts)\n# For simple fonts, it often works without complex dependencies.\nac.print_ascii_art(\"Hello Registry!\", font=\"slant\")","lang":"python","description":"Demonstrates basic text coloring, style chaining, background/foreground combinations, and the integrated logging features. It also includes an example of ASCII art generation."},"warnings":[{"fix":"Change `ASCIIColors.print_ascii_art(...)` to `ascii_colors.print_ascii_art(...)` or `ac.print_ascii_art(...)` if you use `import ascii_colors as ac`.","message":"The `print_ascii_art` method was moved from being a method of the `ASCIIColors` class to a top-level function directly in the `ascii_colors` module.","severity":"breaking","affected_versions":">=0.11.16"},{"fix":"Refer to the latest documentation or source code for the correct logging configuration methods, e.g., use `set_log_level` instead of `set_logging_level`.","message":"Several logging configuration methods, such as `set_logging_level` and `set_level_colors`, were renamed or removed during the 0.11.x development cycle.","severity":"breaking","affected_versions":">=0.11.1"},{"fix":"Always ensure output is directed to a compatible terminal emulator. For logging to files, use the library's built-in logging system which can be configured to strip ANSI codes when output is not a terminal (e.g., `ascii_colors.set_log_file()`).","message":"Color codes and ASCII art may display incorrectly or fill output with raw escape sequences when redirected to a file or piped to a non-terminal application, as `ascii-colors` assumes a TTY by default.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Ensure the output is directed to a compatible terminal emulator (e.g., Windows Terminal, iTerm2). When logging to files, use `ascii_colors.set_log_file()` to automatically strip codes or ensure your log formatters handle it.","cause":"The output is being redirected to a file, piped to another command, or viewed in an IDE terminal that does not interpret ANSI escape codes, leading to raw codes being printed.","error":"^[[31mThis is red text.^[[0m (or similar literal ANSI escape sequences)"},{"fix":"Update your code to call the function directly from the module: `ascii_colors.print_ascii_art(...)` (or `ac.print_ascii_art(...)` if using an alias).","cause":"The `print_ascii_art` method was moved from being a static method of the `ASCIIColors` class to a standalone function in the `ascii_colors` module in versions 0.11.16 and later.","error":"AttributeError: type object 'ASCIIColors' has no attribute 'print_ascii_art'"},{"fix":"Use a modern terminal emulator (e.g., Windows Terminal, Alacritty, iTerm2, Kitty, GNOME Terminal). Verify your terminal's settings to ensure ANSI color code interpretation is enabled.","cause":"Your terminal emulator does not support ANSI escape codes, or support is disabled. This is particularly common in older versions of Windows Command Prompt without additional tools or modern terminal applications.","error":"Colors are not showing up in my terminal, only plain text."}]}