Skip to main content

A Python library for pretty console printing with colors and styles

Project description

Sure, here's a README.md documentation template for your ASCIIColors utility:

ASCIIColors

ASCIIColors is a Python utility that provides an easy way to add color and style to text output in the console. It offers a simple interface for printing text with various colors and styles, making it especially useful for enhancing the readability of console-based applications or adding emphasis to specific messages.

Table of Contents

Installation

You can install ASCIIColors via pip from the Python Package Index (PyPI):

pip install ascii_colors

Usage

ASCIIColors provides a set of methods for printing text with different colors and styles. Here's a basic example of how to use it:

from asciicolors import ASCIIColors

# Print text in bright red color
ASCIIColors.print("Hello, world!", ASCIIColors.color_bright_red)

Methods

ASCIIColors provides the following methods for formatting and printing text:

  • print(text, color=color_bright_red, style="", end="\n", flush=False): Prints text with the specified color and style.

  • warning(text, end="\n", flush=False): Prints text in a warning style.

  • error(text, end="\n", flush=False): Prints text in an error style.

  • success(text, end="\n", flush=False): Prints text in a success style.

  • info(text, end="\n", flush=False): Prints text in an info style.

  • red(text, end="\n", flush=False): Prints text in red color.

  • green(text, end="\n", flush=False): Prints text in green color.

  • blue(text, end="\n", flush=False): Prints text in blue color.

  • yellow(text, end="\n", flush=False): Prints text in yellow color.

  • magenta(text, end="\n", flush=False): Prints text in magenta color.

  • cyan(text, end="\n", flush=False): Prints text in cyan color.

  • bold(text, color=color_bright_red, end="\n", flush=False): Prints text in bold style with the specified color.

  • underline(text, color=color_bright_red, end="\n", flush=False): Prints text with an underline style and the specified color.

  • activate(color_or_style): Activates a specific color or style for subsequent text printing.

  • reset(): Resets the color and style settings to their default values.

  • resetColor(): Resets the color settings to their default value.

  • resetStyle(): Resets the style settings to their default value.

  • resetAll(): Resets both color and style settings to their default values.

Examples

Here are some examples of how to use ASCIIColors to enhance your console output:

from asciicolors import ASCIIColors

# Print an error message
ASCIIColors.error("This is an error message")

# Print a success message
ASCIIColors.success("Operation successful")

# Print a warning message
ASCIIColors.warning("Warning: This action cannot be undone")

# Print text in bold and underline style
ASCIIColors.bold("Important message", ASCIIColors.color_bright_blue)
ASCIIColors.underline("Underlined text", ASCIIColors.color_bright_green)

Contributing

Contributions to ASCIIColors are welcome! If you have ideas for improvements or new features, please feel free to open an issue or submit a pull request. Make sure to follow the contribution guidelines.

License

ASCIIColors is licensed under the Apache License 2.0. You are free to use, modify, and distribute this utility as per the terms of the license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ascii_colors-0.1.1.tar.gz (7.6 kB view hashes)

Uploaded Source

Built Distribution

ascii_colors-0.1.1-py3-none-any.whl (8.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page