Skip to main content

coloring terminal output using '<tags> embedded in strings'

Project description

Hi there! Here a TagsColoredPrint

Python script for coloring terminal output using ' embedded in strings' (like a simle text markup language)

Installation

pip install ctprint

Usage

Initialization

  from ctprint import ctp, ctdecode, cterr, ctlog # callable

ctp.help()

print colored and some interactive help-message. nothing return

ctp.help() # print help message

output:

ctp(string: str)

obj of ctprint. decode <tags> in the string and print it. nothing return

ctp('<bw> black text on white background /> default formating') # decode <tags> and then print the string

ctdecode( *strings: str) -> str

decode <tags> in the strings and return it decoded

ctdecode('<bw> black text on white background /> default formating') # decode <tags> and then print the string

return string

cterr(exception=None, comment='') -> None

exception required. print colored error message from try/except. nothing return

try:
  1/0 #any broken line
except Exception as _ex:
  cterr(_ex)

ctlog(**vars) -> None

vars required. print colored message with names $ values of all **vars. nothibg return

var0 = var1 = 0

def example_ctlog():

  var2 = 'string val'  # out of the try, out of the function, var0=var2 - nothing problems.
  var3 = {'ctp_string': '<bg_red><red>red text on red background (NO) >'}

  ctlog(var0=var0, var1=var1, var2=var2, var3=var3)

Thanks

ctprint.help()

```

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

ctprint-0.1.4.tar.gz (33.0 kB view hashes)

Uploaded Source

Built Distribution

ctprint-0.1.4-py3-none-any.whl (37.2 kB view hashes)

Uploaded Python 3

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