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 hashes)

Uploaded source

Built Distribution

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

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page