Skip to main content

Hi there! Here a Color-Tagged Print

Cross-platform colorization terminal text using '<tags> embedded in strings' (text markup)

Installation

pip install ctprint

or

poetry add ctprint

Usage

Initialization

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

ctp.help() -> None

print colored and some interactive help-message. nothing return

ctp.help()  # print help message

ctp(*strings: str) -> None

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

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

ctdecode( *strings: str) -> str

decode <tags> in the strings and return it decoded

# decode <tags> in the strings and return decoded string
string0 = ' background /> default'
string1 = ' formating'
ctdecode('<bw> black text on white', string0, string1)

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'
    var3 = {'ctp_string': '<bg_red><red>red text on red background (NO) >'}

    # out of the function, var0=var2 - nothing problems.
    ctlog(var0=var0, var1=var1, var2=var2, var3=var3)

ctprint.help()

Thanks

Release files for ctprint 0.1.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ctprint 0.1.8
File Size Uploaded
ctprint-0.1.8.tar.gz 7.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ctprint 0.1.8
File Interpreter ABI Platform
ctprint-0.1.8-py3-none-any.whl Python 3 none any Details

Total release size: 14.7 kB

Release files / ctprint-0.1.8.tar.gz

Download URL ctprint-0.1.8.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
220edd007a4bde3347b5203bf380aae0bd6af6f55ab07675836a2d9952e62eeb
BLAKE2b-256 checksum
How to use checksums
3079276e2b29571548161ce7862c35501cfdaa3fc0a6ffab471728f7ee1cecd0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.10.2 Windows/10

Release files / ctprint-0.1.8-py3-none-any.whl

Download URL ctprint-0.1.8-py3-none-any.whl
Size 7.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e9b45d76f38228db9b04edf500b68ba1a9b059505186843add4cb1e4f669153a
BLAKE2b-256 checksum
How to use checksums
d0458c2fa7a22da4ae445d337b9e99b6ff761f85205cdd50afa72e4dec58c98d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.10.2 Windows/10

Release history Release notifications | RSS feed

This release

0.1.8 This release

2 release files

0.1.7

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page