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:

Linux/Macos

python3 -m pip install stylizedterminal

Windows

py -m pip install stylizedterminal

Importing the package

import stylizedterminal

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, 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 https://github.com/TimRaXo/stylizedterminal.git
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-1.0.0.tar.gz (5.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-1.0.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for stylizedterminal-1.0.0.tar.gz
Algorithm Hash digest
SHA256 1f980e79833401ab69fed3242a687c47094542971dd968d75e2a92e4d92db3a5
MD5 408d875c4ceeed5169e191c0f5c03bc9
BLAKE2b-256 de824b357572a04372b8540e5e5a00eb03e55d3db81cda10e53e3691d7a55d4f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for stylizedterminal-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e4d1733fbd9b39fa54811d80d4a6bfef7db50cb8c6dea7a5273d78bdc59926ad
MD5 6298891c3b841dd88ecfb3384e4a56f3
BLAKE2b-256 ef58e46b0871135a1f19c3c319d40462c9b285eeb288d4a8e7154cf3feb7696c

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