Skip to main content

A lightweight terminal styling helper with ANSI colors, cursor movement, and ASCII art helpers.

Project description

stylizedterminal

stylizedterminal is a lightweight Python package for adding terminal styling to text using ANSI escape codes. It provides helpers for colors, background colors, bold/italic/underline/strikethrough text, cursor movement, screen clearing, and simple ASCII art.

Installation

Install the package from PyPI:

pip install stylizedterminal

Importing the package

import stylizedterminal
from stylizedterminal import StylizedStr

Usage

Text colors

from stylizedterminal import StylizedStr

print(StylizedStr("Hello").color("red"))
print(StylizedStr("Hello").color("green"))

Background colors

from stylizedterminal import StylizedStr

print(StylizedStr("Hello").background_color("blue"))

Text styles

from stylizedterminal import StylizedStr

print(StylizedStr("Hello").bold())
print(StylizedStr("Hello").italic())
print(StylizedStr("Hello").underline())
print(StylizedStr("Hello").strikethrough())

Cursor movement and screen clearing

from stylizedterminal import StylizedStr, move_cursor, clear_screen

print(StylizedStr("Hello").move_cursor(r, 5)) # The first parameter is the direction, the second parameter is by how much.
clear_screen()

ASCII art

from stylizedterminal import StylizedStr

print(StylizedStr("HELLO").ascii_art()) # if you also want to make it something else for example a different color you will have to call the ascii_art() function first, else it will get confused and print the color code in the ascii.

Development

If you want to work on the package locally:

git clone <your-repo-url>
cd stylizedterminal
python -m venv .venv
source .venv/bin/activate
pip install -e .

Run the tests with:

python -m unittest discover -s tests -v

Project structure

  • src/stylizedterminal/ contains the package source code
  • tests/ contains the test suite
  • pyproject.toml defines packaging metadata

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

stylizedterminal-0.2.0.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stylizedterminal-0.2.0-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file stylizedterminal-0.2.0.tar.gz.

File metadata

  • Download URL: stylizedterminal-0.2.0.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for stylizedterminal-0.2.0.tar.gz
Algorithm Hash digest
SHA256 c04d8c4d2168e7d46867075df28db551e3d901859980791fc872560b5625281f
MD5 3d3a8da5c4604dd7f71e8e0097d667c6
BLAKE2b-256 3206b3e5d1d688b5831d2c171aa70e05d49675b4f2b8b8984b368b7cd4c860f0

See more details on using hashes here.

File details

Details for the file stylizedterminal-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for stylizedterminal-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d01a555b8060d9b406d6f8c5a028c99515d67e1daba2c861636318dbff2881ae
MD5 56f84337dedd88ba099a5aa6a19f3678
BLAKE2b-256 84a4774c67ed165f8a0a58623dc45713a173756673badf284fca81817b8f4e0c

See more details on using hashes here.

Supported by

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