Skip to main content

Style your terminal-printed text

Project description

logo

Terminal Style - simple text styling for your terminal

Feature Status
Package Python 3.10+
License MIT License
Meta Code style: black Ruff

Styling text in a terminal is a pain and weirdly, there are no great libraries for this. So I made a very simple lightweight Python library for styling terminal text with colors, backgrounds, and text effects. No complex features, no hassle.

Using terminal-style

install using pip:

pip install terminal-style

Requirements

  • Python 3.10+
  • PyYAML

The two main functions are sprint and style.

  • sprint is a wrapper around print that allows you to style the text.

  • style is a function that returns a styled string.

Available Colors

Category Available Styles
Colors/Backgrounds
Text Effects blink, bold, dim, italic, overline, reverse, strikethrough, underline, hidden (not here duh)

Usage

print styled text with sprint

# Combine multiple effects
sprint("Important Notice", color="yellow", bg_color="red", bold=True, underline=True)

# Use with print parameters
sprint("Loading...", color="cyan", end="")  # No newline
sprint("Done!", color="green")

# Extended color palette
sprint("Beautiful", color="pink", italic=True)
sprint("Ocean", color="turquoise", bold=True)

get styled text with style

from terminal_style import style

# Create styled strings for use in larger text
error_text = style("ERROR", color="red", bold=True)
warning_text = style("WARNING", color="yellow", bold=True)

print(f"[{error_text}] Something went wrong!")
print(f"[{warning_text}] This is a warning message")

Development

Contributions are welcome! Please feel free to submit a Pull Request.

git clone https://github.com/colinfrisch/terminal-style
cd terminal-style
pip install -e .

Install development dependencies:

pip install -e ".[dev]"

Run tests:

pytest
# or
python run_tests.py

License

This project is licensed under the MIT License - see the LICENSE file for details.

Author : Colin Frisch - colin.frisch@gmail.com


Make your terminal output beautiful and readable with terminal-style!

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

terminal_style-0.0.1.tar.gz (51.9 kB view details)

Uploaded Source

Built Distribution

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

terminal_style-0.0.1-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file terminal_style-0.0.1.tar.gz.

File metadata

  • Download URL: terminal_style-0.0.1.tar.gz
  • Upload date:
  • Size: 51.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for terminal_style-0.0.1.tar.gz
Algorithm Hash digest
SHA256 e3f4a79970806a846c54d800466a394bd5302655fdbe1ad51f8ca1ad0a0c48f5
MD5 cc1580dcd02825fcaf3583359ea952e5
BLAKE2b-256 3bcf2a04ec820ebf9398acf04f167ca57911a5ea2632696d0766e3efaff35a0d

See more details on using hashes here.

File details

Details for the file terminal_style-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: terminal_style-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for terminal_style-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4fb880d9e1bdbd711a2254ede1fe3a907719144225abde73156fe17db6d0adde
MD5 75ac160d6db186f116d68dea11d42dbc
BLAKE2b-256 0d893741e499851c516d816a763666c4efa2762c274b7de1265415ed974746e7

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