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.2.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.2-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: terminal_style-0.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 0ed30f93ce15c8635de54444f2ae84b3c8ae68ff3e5f99f9eed41e9501882250
MD5 4ad261f7cc3e1a5f790ca6d97d175789
BLAKE2b-256 83b9993581745f09a296ba73e16cebe1533d3d6e9025fdc1491760755f57bd27

See more details on using hashes here.

File details

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

File metadata

  • Download URL: terminal_style-0.0.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 118bbef357379b4c2c60646432a9cf1483da80acf6fdbedc48279e78f06dae62
MD5 a7a6083877c5dfab49d77ebddc313cba
BLAKE2b-256 d476dda31dc37543654517d8dc70188d478f30b28d422a2466149d523fb718a1

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