Terminal text styling made simple, like colorama but cooler.
Project description
Textura
Textura is a Python package for terminal text styling, similar to colorama, but with more features and flexibility. With Textura, you can easily add foreground colors, background colors, and text styles (bold, italic, underline) to your terminal output.
Installation
You can install Textura using pip:
pip install textura
Usage
Here is an example usage
import textura
from textura import Fore, Back, Style, txtra_print, txtra_format, option, colors_list, PrintError
# Set options (reset text at end, and prevent styled text in print())
option(resetend=True, strict=True)
# Display available colors and styles
print("Available styles and colors:")
colors_list()
print("\n--- Styled Print Examples ---\n")
# Foreground color example
txtra_print("{Fore.GREEN}Green text")
# Background color example
txtra_print("{Back.YELLOW}{Fore.BLACK}Black on yellow")
# Style example
txtra_print("{Style.BOLD}Bold text")
txtra_print("{Style.UNDERLINE}Underlined text")
txtra_print("{Style.ITALIC}Italic text")
# Combined styles
txtra_print("{Back.RED}{Fore.WHITE}{Style.BOLD}Bold white on red background")
# Using txtra_format to return a styled string
formatted = txtra_format("{Fore.YELLOW}{Style.UNDERLINE}Underlined Light Blue")
print(formatted) # This works fine
# Incorrect usage: using styled text directly with print (strict=True will raise PrintError)
try:
print("{Fore.RED}This should raise an error if strict=True")
except PrintError as e:
print(f"Caught PrintError: {e}")
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file textura-1.1.0.tar.gz.
File metadata
- Download URL: textura-1.1.0.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
79e90df6e4093351888f4c7621367c20d8d54915601af86b4318f2a75cdb19da
|
|
| MD5 |
1228b64cd5d83813bffbb98c625649cb
|
|
| BLAKE2b-256 |
50e4b42b1656dfb8fdf96494cf3c3b498b1687e50646781d7f4aefe6d0056eca
|
File details
Details for the file textura-1.1.0-py3-none-any.whl.
File metadata
- Download URL: textura-1.1.0-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f69a653644b16a052045c08a82bfcf1ed172b0f71d6fbad0df25f5d3464870f
|
|
| MD5 |
468e95312e1a77054162b06625594be0
|
|
| BLAKE2b-256 |
b73431115aa718d23f01e9268c7dece99e5629d20c77d94d7d585b58f33e3bb8
|