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+ PyPI Downloads
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.

install using pip:

pip install terminal-style

Using terminal-style : 3 tools that will make your life easier

  • sprint is a wrapper around print that allows you to style the text :
sprint("Hello, world!", color="red", bold=True)
logo
  • style is a function that returns a styled string formatted terminal use. Can be used in regular print statements :
print(
  style("Hello", color="red", bold=True),
  style("old", color="blue", italic=True),
  style("friend", color="green", underline=True),
  style("!", color="yellow", bold=True),
)
logo
  • spinner is a function that will show a spinner in the terminal :
spinner("Loading...", color="cyan", bold=True, type="dots")
logo

Available Colors

color/bg_color Spinner Text Effect
black dots bold
red line | dim
green arrow italic
yellow bouncingBar [ ] underline
blue bouncingBall ( ● ) blink
magenta/purple earth 🌍 reverse
cyan moon 🌑 hidden
white weather ☀️ strikethrough
bright_black/gray/grey hearts 💛 strike
bright_red runner 🚶 double_underline
bright_green modern ▰▱▱▱▱▱▱ overline
bright_yellow growVertical
bright_blue growHorizontal
bright_magenta
bright_purple
bright_cyan
bright_white
orange
pink
light_pink
deep_pink
lime
gold
navy
maroon
olive
teal
silver
brown
indigo
violet
turquoise
coral
salmon
khaki
crimson
forest_green
sky_blue
lavender
peach
mint

Incoming Features

  • automatic indentation of text
  • pre-built styles for common use cases
  • support for custom styles

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.3.tar.gz (81.8 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.3-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: terminal_style-0.0.3.tar.gz
  • Upload date:
  • Size: 81.8 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.3.tar.gz
Algorithm Hash digest
SHA256 6333a1d1e39232420e29640881a10fea9755a974e31edddcc882b5d8bcec0bf9
MD5 e96cd2f357816e2c3d3e021f50be017a
BLAKE2b-256 0304ff1b7c879ca5ba8af7053aafe7066ffe87ed559d1d2a43ab5e5114a3e277

See more details on using hashes here.

File details

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

File metadata

  • Download URL: terminal_style-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 9.9 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 0a496260a87c6bc5cb4e0caa30f2421e876da32c61eea1ef65b6f291fcab80e6
MD5 c07a8aae6b3fb8ed93f5fa022bf2cadd
BLAKE2b-256 51270a17aa18fdc1022ba8eff4212e4d5a7b97001b6e03803bd0df7242a635ca

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