
Stop wrestling with multiple libraries for essential CLI features!
ASCIIColors is your unified toolkit for creating modern, engaging, and informative Python terminal applications. Forget bland print() statements and complex logging setups. Embrace vibrant colors, structured logging, sleek progress bars, interactive menus, and helpful utilities β all from a single, elegant library.
Simple colorful and stylish printing

Complete logging system fully compatible with python logging library


TQDM like colorful progressbars

User interaction utilities

β¨ Why Choose ASCIIColors?
- π¨ Dual Approach: Seamlessly switch between simple, direct color printing for immediate feedback and a powerful, structured logging system for application events.
- πͺ΅ Logging Powerhouse: Get instantly colored, leveled console logs (
stderr default) with basicConfig. Easily configure file logging, JSON output, log rotation, custom formats, and context injection. Features a logging-compatible API (getLogger, basicConfig, Handlers) for painless adoption.
- π Integrated Progress Bars: Display
tqdm-like progress bars for loops or tasks with customizable styles (fill, blocks, line, emoji) and colors, directly integrated.
- π±οΈ Interactive Menus: Build intuitive, visually styled command-line menus with arrow-key navigation, different selection modes (
execute, select_single, select_multiple), filtering, inline input fields, help text, and submenus.
- π€ User Interaction: Easily prompt users for text input (with optional hidden input for passwords) and ask for yes/no confirmation using
prompt() and confirm().
- βοΈ Utilities Included: Comes with
execute_with_animation (console spinner), highlight (text emphasis), multicolor (inline colored text), and trace_exception (easy error logging).
- π Simplify Your Stack: Reduce project dependencies and complexity by using one library for colors, logging, progress bars, menus, and basic user interaction.
- β
Effortless Integration: Use the familiar
import ascii_colors as logging pattern or the native ASCIIColors API. Direct print methods remain independent for simple use cases.
π Installation
pip install ascii_colors
(Optional: For accurate wide-character support (like emojis) in ProgressBar, install wcwidth: pip install wcwidth)
π Core Concepts: Direct Print vs. Logging System
Understanding this difference is fundamental:
-
Direct Print Methods (ASCIIColors.red, print, bold, bg_red, prompt, confirm, etc.):
- Mechanism: Use Python's
print() (or input/getpass) to directly interact with the terminal (default: sys.stdout/stdin). Outputs strings with specified ANSI colors/styles.
- Scope: Completely bypasses the logging system. Levels, Handlers, Formatters, Context are ignored.
- Use Case: Ideal for immediate visual feedback, status messages, banners, prompts, user input/confirmation, menus, progress bars, animations, or decorative output where structured logging features aren't necessary.
-
Logging System (basicConfig, getLogger, logger.info, ASCIIColors.info, Handlers, Formatters):
- Mechanism: Creates structured log records, filters them by level, formats them into strings using
Formatters, and dispatches them via Handlers to destinations (console, file, etc.). Mimics Python's standard logging module.
- Scope: Provides leveled logging, output routing, filtering, contextual information, and flexible formatting. Console output is typically colored by log level.
- Interaction: Use
import ascii_colors as logging (recommended) or ASCIIColors.info() methods. Both control the same global logging state.
- Use Case: Best for application logs, debugging, tracing events, audit trails β any scenario needing structured, configurable, and routable output.
Utility Interactions: highlight, multicolor, execute_with_animation, Menu, ProgressBar, confirm, and prompt use Direct Printing for their visual output/interaction. trace_exception uses the Logging System.
π¨ Direct Printing In-Depth
Instantly add color and style to terminal output.
Basic Usage
Call static methods on ASCIIColors for specific colors or styles.
from ascii_colors import ASCIIColors
ASCIIColors.red("Error: File processing failed.")
ASCIIColors.green("Success: Data saved.")
ASCIIColors.yellow("Warning: Using default value.")
ASCIIColors.blue("Info: Connecting to server...")
ASCIIColors.bold("This is important!")
ASCIIColors.underline("Please read the instructions.")
ASCIIColors.italic("Note: This is experimental.", color=ASCIIColors.color_magenta)
Advanced Usage with ASCIIColors.print()
The core direct print method offers full control.
from ascii_colors import ASCIIColors
import sys
ASCIIColors.print(
" Detailed Status ",
color=ASCIIColors.color_black,
style=ASCIIColors.style_bold,
background=ASCIIColors.color_bg_cyan,
end="\n\n",
flush=True,
file=sys.stdout
)
combined_style = ASCIIColors.style_bold + ASCIIColors.style_underline + ASCIIColors.style_italic
ASCIIColors.print(
"Multi-styled Text",
color=ASCIIColors.color_bright_white,
style=combined_style
)
Available Colors & Styles Constants
Access these as ASCIIColors.<constant_name>:
- Reset:
color_reset (resets all)
- Styles:
style_bold
style_dim
style_italic
style_underline
style_blink (support varies)
style_reverse (swaps foreground/background)
style_hidden (support varies)
style_strikethrough
- Foreground (Regular):
color_black, color_red, color_green, color_yellow, color_blue, color_magenta, color_cyan, color_white, color_orange (256-color)
- Foreground (Bright):
color_bright_black (gray), color_bright_red, color_bright_green, color_bright_yellow, color_bright_blue, color_bright_magenta, color_bright_cyan, color_bright_white
- Background (Regular):
color_bg_black, color_bg_red, color_bg_green, color_bg_yellow, color_bg_blue, color_bg_magenta, color_bg_cyan, color_bg_white, color_bg_orange (256-color)
- Background (Bright):
color_bg_bright_black (gray), color_bg_bright_red, color_bg_bright_green, color_bg_bright_yellow, color_bg_bright_blue, color_bg_bright_magenta, color_bg_bright_cyan, color_bg_bright_white
(Note: Rendering depends on terminal emulator capabilities.)
Inline Multicolor Text (multicolor)
Print segments with different styles on the same line.
from ascii_colors import ASCIIColors
ASCIIColors.multicolor(
["Processing: ", "FileA.txt", " [", "OK", "] ", "Size: ", "1.2MB"],
[
ASCIIColors.color_white,
ASCIIColors.color_cyan,
ASCIIColors.color_white,
ASCIIColors.color_green + ASCIIColors.style_bold,
ASCIIColors.color_white,
ASCIIColors.color_white,
ASCIIColors.color_yellow
]
)
Highlighting Substrings (highlight)
Emphasize parts of a string.
from ascii_colors import ASCIIColors
log_entry = "ERROR: Failed login attempt for user 'admin' from IP 192.168.1.101"
ASCIIColors.highlight(
text=log_entry,
subtext=["ERROR", "admin", "192.168.1.101"],
color=ASCIIColors.color_white,
highlight_color=ASCIIColors.color_bright_yellow + ASCIIColors.style_underline,
)
Persistent Styles (activate/reset)
Apply a style that stays active until reset (less common, use print usually).
from ascii_colors import ASCIIColors
ASCIIColors.activate(ASCIIColors.color_blue + ASCIIColors.style_italic)
print("This text will be blue and italic.")
print("This text will also be blue and italic.")
ASCIIColors.reset()
print("This text is back to normal.")
πͺ΅ Logging System In-Depth
Build robust, structured, and configurable logs.
The Compatibility Layer (import ascii_colors as logging)
This is the recommended way to use the logging system. It provides a familiar interface.
import ascii_colors as logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger("MyService")
logger.info("Service started.")
Configuration with basicConfig()
The easiest way to set up basic logging. Call it only once at application start (unless force=True).
Common Parameters:
level: Minimum level for the root logger (and default handlers). E.g., logging.DEBUG, "INFO", 30. Default: WARNING.
format (or fmt): Log message format string (see Formatter Placeholders). Default: %(levelname)s:%(name)s:%(message)s (uses % style).
datefmt: Format string for %(asctime)s. Default: ISO-like "%Y-%m-%d %H:%M:%S,%f".
style: Format string style ('%' or '{'). Default: '%'.
stream: Target stream for the default ConsoleHandler (e.g., sys.stdout). Default: sys.stderr. Ignored if filename or handlers is used.
filename: Path to log file. Creates a FileHandler. Incompatible with stream or handlers.
filemode: File open mode ('a' append, 'w' write). Default: 'a'. Requires filename.
encoding: File encoding (e.g., 'utf-8'). Requires filename.
handlers: A list of pre-configured handler instances. If provided, stream and filename are ignored.
force: If True, removes existing handlers before configuring. Allows calling basicConfig multiple times. Default: False.
Examples:
import ascii_colors as logging
from pathlib import Path
import sys
log_file = Path("app_combined.log")
logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(message)s')
file_formatter = logging.Formatter('%(asctime)s | %(message)s')
file_handler = logging.FileHandler(log_file, level=logging.DEBUG, formatter=file_formatter)
logging.getLogger().addHandler(file_handler)
logger = logging.getLogger("Combined")
logger.info("Goes to console and file.")
logger.debug("Goes to file only.")
Manual Configuration (Full Control)
For complex scenarios involving multiple handlers, specific formatters, or fine-grained control.
Steps:
- Get Logger:
logger = logging.getLogger("MyComponent") (Use names like parent.child for hierarchy).
- Create Formatter(s):
fmt = logging.Formatter(fmt=..., datefmt=..., style=..., include_source=...)
json_fmt = logging.JSONFormatter(fmt=..., datefmt=..., style=..., include_fields=..., ...)
- Create Handler(s):
con_h = logging.ConsoleHandler(stream=..., level=..., formatter=...) (or StreamHandler)
file_h = logging.FileHandler(filename=..., mode=..., encoding=..., level=..., formatter=...)
rot_h = logging.handlers.RotatingFileHandler(filename=..., maxBytes=..., backupCount=..., level=..., formatter=...)
- Add Handlers to Logger:
logger.addHandler(handler_instance) (or add to root logger logging.getLogger().addHandler(...) to affect all loggers).
- Set Logger Level (Optional):
logger.setLevel(logging.DEBUG) (Controls messages passed from this logger to its handlers. Global level ASCIIColors.set_log_level filters before any logger).
Example:
import ascii_colors as logging
from ascii_colors import handlers
from pathlib import Path
import sys
root_logger = logging.getLogger()
module_logger = logging.getLogger("MyModule")
logging.ASCIIColors.set_log_level(logging.DEBUG)
root_logger.setLevel(logging.INFO)
console_format = "[{levelname:<8}] {message} ({name})"
console_fmt = logging.Formatter(console_format, style='{', datefmt='%H:%M:%S')
file_format = "%(asctime)s|%(levelname)-8s|%(name)s:%(lineno)d|%(message)s"
file_fmt = logging.Formatter(file_format, style='%', include_source=True)
console_handler = logging.ConsoleHandler(stream=sys.stdout, level=logging.INFO)
console_handler.setFormatter(console_fmt)
file_handler = logging.FileHandler("manual_app.log", mode='w', level=logging.DEBUG)
file_handler.setFormatter(file_fmt)
root_logger.handlers.clear()
root_logger.addHandler(console_handler)
root_logger.addHandler(file_handler)
module_logger.info("Module starting.")
module_logger.debug("Low-level details.")
Formatter Placeholders
Use these within format strings (fmt parameter):
% Style (Default):
%(asctime)s: Human-readable time (configured by datefmt).
%(created)f: Time of creation (float, time.time()).
%(filename)s: Filename part of pathname. Requires include_source=True.
%(funcName)s: Name of function containing the log call. Requires include_source=True.
%(levelname)s: Text logging level ('DEBUG', 'INFO', etc.).
%(levelno)s: Numeric logging level (10, 20, etc.).
%(lineno)d: Line number where log call occurs. Requires include_source=True.
%(message)s: The logged message itself.
%(module)s: Module name (filename without extension). Requires include_source=True.
%(msecs)d: Millisecond portion of timestamp.
%(name)s: Name of the logger used.
%(pathname)s: Full path to the source file. Requires include_source=True.
%(process)d: Process ID.
%(processName)s: Process name (usually Python thread name).
%(relativeCreated)d: Time in milliseconds since logger initialized.
%(thread)d: Thread ID.
%(threadName)s: Thread name.
%(<custom_key>)s: Any key passed via extra={...} or context.
{} Style: Use the same names within braces, e.g., {asctime}, {levelname}, {name}, {message}, {filename}, {lineno}, {funcName}, {custom_key}.
Note: Retrieving filename, pathname, lineno, funcName, module requires setting include_source=True on the Formatter, which adds performance overhead due to stack inspection.
JSON Formatter (JSONFormatter)
Log structured JSON, ideal for log aggregation systems.
import ascii_colors as logging
from pathlib import Path
log_file = Path("audit.jsonl")
json_formatter = logging.JSONFormatter(
fmt={
"ts": "%(asctime)s",
"lvl": "%(levelname)s",
"log": "%(name)s",
"msg": "%(message)s",
"ctx": {
"request": "%(request_id)s",
"user": "%(user_id)s",
"file": "%(filename)s"
},
"exc_info": "%(exc_info)s"
},
datefmt="iso",
style='%',
json_ensure_ascii=False,
json_indent=None,
json_sort_keys=False,
include_source=True
)
json_handler = logging.FileHandler(log_file, mode='w')
json_handler.setFormatter(json_formatter)
logging.basicConfig(level=logging.INFO, handlers=[json_handler], force=True)
logger = logging.getLogger("API")
try:
1 / 0
except Exception as e:
logger.error("Processing failed for request.",
extra={"user_id": "usr_456", "request_id": "req_xyz"},
exc_info=True)
Logging Messages & Exceptions
Use standard logger methods.
import ascii_colors as logging
from ascii_colors import trace_exception
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger("Processor")
logger.debug("Starting step %d...", 1)
logger.info("Processing record %s.", "ID-001")
logger.warning("Timeout occurred for %s.", "ID-002")
logger.error("Failed to write output for %s.", "ID-003")
logger.critical("System integrity check failed!")
logger.info("User %s performed action %s on resource %d.", "admin", "UPDATE", 42)
try:
result = 1 / 0
except ZeroDivisionError as e:
logger.exception("Arithmetic error during calculation for ID %s.", "ID-004")
Context Management (Thread-Local)
Enrich logs automatically with contextual data relevant to the current thread or task.
- Set Context:
ASCIIColors.set_context(key1=value1, key2=value2): Sets context for the current thread.
with ASCIIColors.context(key1=value1, key2=value2): ...: Sets context only within the with block. Automatically restores previous state on exit.
- Configure Formatter: Ensure your
Formatter includes the context keys (e.g., %(request_id)s or {request_id}).
- Log: Messages logged within the context scope will include the values.
from ascii_colors import ASCIIColors, Formatter, ConsoleHandler, getLogger, INFO
import threading, time, sys
fmt_string = "[{asctime}] Req:{req_id}|User:{user} [{levelname}] {message}"
formatter = Formatter(fmt_string, style='{', datefmt='%H:%M:%S')
handler = ConsoleHandler(stream=sys.stdout, formatter=formatter)
ASCIIColors.clear_handlers(); ASCIIColors.add_handler(handler); ASCIIColors.set_log_level(INFO)
logger = getLogger("ContextDemo")
def handle_request(request_id, user_name):
with ASCIIColors.context(req_id=request_id, user=user_name):
logger.info("Request received")
time.sleep(0.05)
logger.info("Processing complete")
threads = [
threading.Thread(target=handle_request, args=(f"R{i}", f"User{i}")) for i in range(3)
]
for t in threads: t.start()
for t in threads: t.join()
You can retrieve the current context dictionary using ASCIIColors.get_thread_context().
π Progress Bar (ProgressBar)
Display tqdm-like progress indicators. Uses Direct Printing.
Key Parameters:
iterable: Optional iterable to wrap (like tqdm(iterable)).
total: Total number of expected iterations (required if iterable has no len).
desc: String description prefix.
unit: Label for iterations (default: "it").
ncols: Fixed width for the entire bar; None for auto-detect.
bar_format: Custom format string. Use placeholders like {l_bar}, {bar}, {r_bar}, {n_fmt}, {total_fmt}, {percentage}, {elapsed}, {remaining}, {rate_fmt}. For indeterminate bars (no total), only {l_bar}, {bar}, {n}, {elapsed}, {rate_fmt}, {unit} are reliably substituted.
leave: Keep the completed bar on screen (True) or clear it (False). Default: True.
mininterval: Minimum time in seconds between display updates. Default: 0.1.
color, style, background: ASCIIColors constants for bar/text styling.
bar_style: 'fill' (default, solid block), 'blocks' (smoother Unicode blocks), 'line' (growing line), 'emoji' (uses custom chars).
progress_char, empty_char: Characters for filled/empty parts. Ignored for 'emoji'. Defaults vary by bar_style.
emoji_fill, emoji_empty: Characters used for 'emoji' style (defaults: π, π).
Examples:
from ascii_colors import ProgressBar, ASCIIColors
import time
items = range(200)
print("Wrapping an iterable:")
for item in ProgressBar(items, desc="Processing", unit=" tasks", color=ASCIIColors.color_green):
time.sleep(0.01)
print("\nManual control ('blocks' style):")
total_size = 500
with ProgressBar(total=total_size, desc="Downloading", unit=" KB",
color=ASCIIColors.color_bright_blue, style=ASCIIColors.style_bold,
bar_style="blocks",
mininterval=0.05) as pbar:
for i in range(total_size):
time.sleep(0.005)
pbar.update(1)
if i == total_size // 2:
pbar.set_description("Half done...")
print("\n'line' style:")
for item in ProgressBar(range(100), desc="Line Task", bar_style='line', color=ASCIIColors.color_magenta):
time.sleep(0.015)
print("\n'emoji' style:")
for item in ProgressBar(range(60), desc="Rockets", bar_style='emoji',
emoji_fill="π", emoji_empty="π"):
time.sleep(0.03)
print("\nIndeterminate style:")
with ProgressBar(desc="Waiting...", color=ASCIIColors.color_yellow) as pbar:
for _ in range(5):
time.sleep(0.5)
pbar.update(10)
Build styled CLI menus with arrow-key navigation, different modes, filtering, and input. Uses Direct Printing.
Key Menu Parameters:
title: Menu title.
parent: Link to parent Menu for 'Back' navigation.
mode: 'execute' (run actions), 'select_single' (return one value), 'select_multiple' (return list of values). Default: 'execute'.
clear_screen_on_run: Clear terminal before showing (True).
hide_cursor: Attempt to hide cursor during interaction (True).
enable_filtering: Allow typing to filter items (False).
help_area_height: Number of lines reserved below menu for help text (0).
- Styling:
title_color, item_color, selected_color, selected_background, prompt_color, error_color, filter_color, help_color, etc.
- Prefixes:
selected_prefix, unselected_prefix, checkbox_selected, etc.
Adding Items:
.add_action(text, function, *, value=None, exit_on_success=False, item_color=None, help_text=None, disabled=False)
.add_submenu(text, submenu_instance, *, value=None, item_color=None, help_text=None, disabled=False)
.add_choice(text, *, value=None, selected=False, item_color=None, help_text=None, disabled=False): For use in select_single/select_multiple modes.
.add_choices(choices): Adds multiple choice items from a list of (text, value) tuples. Convenient for select_single/select_multiple modes.
.add_input(text, *, initial_value="", placeholder="{input}", value=None, item_color=None, help_text=None, disabled=False): Inline text input.
.add_separator(text=None)
Navigation & Interaction:
- Arrows Up/Down: Move selection.
- Enter:
- Execute action or enter submenu (in
execute mode).
- Select item and exit menu (in
select_single mode).
- Toggle item selection (in
select_multiple mode - see Note below).
- Start editing input field.
- Space: Toggle item selection (in
select_multiple mode).
- Typing (if
enable_filtering=True): Filters the list of items. Backspace removes characters from filter.
- Ctrl+C: Quit main menu, or go back in submenu.
- Input Field Editing: Use
Left/Right/Backspace/Printable Keys. Enter/Escape finishes editing.
Note on Multi-Select Enter: By default, Enter toggles items in select_multiple mode. If you add an action to a choice in multi-select, Enter will execute that action instead of toggling. Use Spacebar for toggling in those cases.
Example:
from ascii_colors import Menu, MenuItem, ASCIIColors
import platform, time
def action_ok(): ASCIIColors.green("Action OK!")
def action_exit_success(): ASCIIColors.success("Exiting Menu!"); return True
root = Menu("Unified CLI Menu", enable_filtering=True, help_area_height=2)
single_sel = Menu("Select Format", parent=root, mode='select_single')
multi_sel = Menu("Select Features", parent=root, mode='select_multiple')
root.add_action("Show Platform", lambda: ASCIIColors.info(f"OS: {platform.system()}"),
help_text="Display the current operating system.")
root.add_submenu("Choose Format", single_sel, help_text="Select one output format.")
root.add_submenu("Configure Features", multi_sel, help_text="Toggle multiple features (Spacebar).")
root.add_action("Action That Exits", action_exit_success, exit_on_success=True,
help_text="This action will close the menu if it succeeds.")
root.add_separator()
root.add_input("Enter Username: ", initial_value="guest", help_text="Type a username here.")
root.add_action("Disabled Action", action_ok, disabled=True)
single_sel.add_choices([
("Text", "txt"),
("JSON", "json"),
("YAML", "yaml"),
])
single_sel.items[0].help_text = "Plain text format."
single_sel.items[1].help_text = "JSON format."
single_sel.items[2].disabled = True
multi_sel.add_choices([
("Verbose Logging", "VERBOSE"),
("Auto Save", "AUTOSAVE"),
("Notifications", "NOTIFY"),
])
multi_sel.items[0].selected = True
multi_sel.items[2].selected = True
ASCIIColors.print("\nStarting interactive menu demo (Arrows, Enter, Space, Type to filter, Ctrl+C)...\n", color=ASCIIColors.color_yellow)
result = root.run()
ASCIIColors.print("\n--- Menu Result ---", color=ASCIIColors.color_bright_white)
if isinstance(result, list):
ASCIIColors.print(f"Multi-select returned: {result}", color=ASCIIColors.color_green)
elif result is not None:
ASCIIColors.print(f"Single-select or Exit Action returned: {result}", color=ASCIIColors.color_cyan)
else:
ASCIIColors.print("Menu exited (Quit/Back/Execute mode completed).", color=ASCIIColors.color_yellow)
input_item = next((item for item in root.items if item.is_input), None)
if input_item:
ASCIIColors.print(f"Username entered was: '{input_item.input_value}'", color=ASCIIColors.color_magenta)
β³ Animation Spinner (execute_with_animation)
Provide visual feedback during blocking operations. Uses Direct Printing.
Key Parameters:
pending_text: Text displayed next to the spinner.
func: The function/callable to execute while the spinner runs.
*args, **kwargs: Arguments passed to func.
color: Optional ASCIIColors color constant for the pending_text.
How it Works:
- Displays
pending_text and an animated spinner (using direct print).
- Runs
func(*args, **kwargs) in a separate thread.
- Logging within
func uses the configured Logging System normally.
- When
func finishes:
- Stops the spinner.
- Prints a final status line (β for success, β for failure) using direct print.
- Returns the result of
func.
- If
func raised an exception, execute_with_animation re-raises it.
Example:
from ascii_colors import ASCIIColors, trace_exception
import time
import ascii_colors as logging
logging.basicConfig(level=logging.INFO, format='>> %(message)s')
def simulate_api_call(endpoint):
logger = logging.getLogger("APICall")
logger.info(f"Calling endpoint: {endpoint}")
time.sleep(2)
if endpoint == "fail":
raise ConnectionError("Could not connect to API")
return {"status": "OK", "data": [1, 2, 3]}
print("\nExecuting task with spinner:")
try:
result = ASCIIColors.execute_with_animation(
"Calling API...", simulate_api_call, "users",
color=ASCIIColors.color_bright_magenta
)
ASCIIColors.success(f"API Call Successful: {result}")
except Exception as e:
ASCIIColors.fail(f"API Call Failed: {e}")
π€ User Interaction (confirm / prompt)
Easily get confirmations or text input from the user directly in the terminal. These methods use Direct Printing for the prompts.
-
ASCIIColors.confirm(question, default_yes=None, ...): Asks a Yes/No question.
- Handles
y/yes and n/no (case-insensitive).
default_yes=True: Enter defaults to Yes ([Y/n]).
default_yes=False: Enter defaults to No ([y/N]).
default_yes=None: Enter is invalid ([y/n]).
- Returns
True for Yes, False for No (or Ctrl+C).
-
ASCIIColors.prompt(prompt_text, color=..., style=..., hide_input=False, ...): Displays a styled prompt and reads a line of text.
- Returns the user's input string.
- Returns an empty string if cancelled with Ctrl+C.
hide_input=True: Don't echo input characters (uses getpass).
from ascii_colors import ASCIIColors
delete_it = ASCIIColors.confirm("Are you sure you want to delete the file?", default_yes=False)
if delete_it:
print("Deleting...")
else:
print("Deletion cancelled.")
proceed = ASCIIColors.confirm("Continue with installation?", default_yes=True)
name = ASCIIColors.prompt("Enter your name: ", color=ASCIIColors.color_cyan)
api_key = ASCIIColors.prompt(
"Enter your API key: ",
color=ASCIIColors.color_yellow,
style=ASCIIColors.style_bold,
hide_input=True
)
if api_key:
print("API Key received.")
else:
print("API Key entry skipped or cancelled.")
π API & Documentation
This README covers the primary functionalities. For a complete API reference and further details, please visit the Full Documentation.
π€ Contributing
Your contributions are welcome! Please see CONTRIBUTING.md for guidelines on reporting issues, proposing features, and submitting pull requests.
π License
ASCIIColors is distributed under the Apache License 2.0. See the LICENSE file for more information.
Elevate your command-line applications. Choose ascii_colors for a unified, powerful, and visually appealing experience!