Skip to main content

Styles terminal text

Project description

YATTS - Yet Another Terminal Text Styler

PyPI PyPI - Downloads GitHub

Styles terminal text

Install

pip install yatts

4-Bit Color Examples

from yatts import style

# Prints yatts with dark green text color
print(style('yatts', ['green', 'dark']))

# Prints yatts with red text color and dark yellow background
print(style('yatts', 'red', ['yellow', 'dark']))

# Prints yatts with white text color, blue background and italic text style
print(style('yatts', bgcolor='blue', italic=True))

# Prints a bold, italic, overlined yatts
print(style('yatts', decorations=['bold', 'italic', 'overline']))

8-Bit Color Examples

from yatts import style

yatts = ' yatts '*10

# Dark green text color
print(style(yatts, 2) + '\n')

# Light red text color with light orange background color
print(style(yatts, 196, 223) + '\n')

# 4-Bit and 8-Bit colors mixed and bold parameter
# combined with decorations parameter
print(style(yatts, 'white', 238, bold=True,
            decorations=['underline','overline']))

8bit examples

Add/Remove Examples

from yatts import *

yatts = ' yatts '*10

yatts = style(yatts, 'blue', 235, decorations=['italic', 'underline'])
print(yatts + '\n')

yatts = add(yatts, 'bold')
print(yatts + '\n')

yatts = remove(yatts, ['color', 'underline'])
print(yatts + '\n')

yatts = remove_all(yatts)
print(yatts)

add remove examples

Function Arguments

Style Function
# Styles a text
def style(
  text,
  color=None,
  bgcolor=None,
  bold=False,
  italic=False,
  underline=False,
  striketrough=False,
  decorations=None
):

All valid strings for decorations:

  • 'bold'
  • 'blink'
  • 'italic'
  • 'overline'
  • 'underline'
  • 'striketrough'
  • 'double_underline'
Add Function
# Adds a specific style to a text
def add(text, style, value=None):
Remove Functions
# Removes one or more specific style from a styled text
def remove(text, style):

# Removes all styles from a styled text
def remove_all(text):

All valid strings for style:

  • 'color'
  • 'bgcolor'
  • 'bold'
  • 'blink'
  • 'italic'
  • 'overline'
  • 'underline'
  • 'striketrough'
  • 'double_underline'

4-Bit Color Palette

4bit color palette

8-Bit Color Palette

8bit color palette

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

yatts-1.0.0.tar.gz (149.6 kB view details)

Uploaded Source

Built Distribution

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

yatts-1.0.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: yatts-1.0.0.tar.gz
  • Upload date:
  • Size: 149.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

File hashes

Hashes for yatts-1.0.0.tar.gz
Algorithm Hash digest
SHA256 6f99f064d029a64b29679d53e964674b8330e40aaf8eaf2fe777bba694666402
MD5 b4aba2bbb631b00e4d7e1ed94a134e58
BLAKE2b-256 d8bc3a280ca0976e3063fab6478725f08f7652922def77d7306eedd68174a816

See more details on using hashes here.

File details

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

File metadata

  • Download URL: yatts-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

File hashes

Hashes for yatts-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7e245bf972e25931ec3827bb7628a00abb6a323d69c2d85ebca2c78e6ef3c246
MD5 82bc67a0bbe2b4bb93865f7a60fd991a
BLAKE2b-256 241ed430913badc14e1e528f943643ff27530090df8482967a134f9892ddb521

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