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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for ascii_colors-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1ae42a320c210fa91e1644d4475a75a4d6f2e2bc49f8a48c3a7d9690c72bb75 |
|
MD5 | cff102a94c1c229d380f08a695bfc014 |
|
BLAKE2b-256 | 7b94fc8976035ac0770ac2a917870e86b40aa2507e02471d9c2784740b6e3811 |