Skip to main content

Can it be used to print in color.

Project description

Python Colorful Print

✅Build And Test PyPI version PyPI
CodeFactor PyPI

Install

pip install colorful_print

Usage

import sys
from colorful_print import cp

a = [1, "a", 2.345]
b = (4, "b", 5.678)
c = {"John": "Doe", "age": 20}

cp.black("This is Black", a, b, c)
cp.bright_black("This is Bright Black", a, b, c)
cp.red("This is Red", a, b, c)
cp.bright_red("This is Bright Red", a, b, c)
cp.green("This is Green", a, b, c)
cp.bright_green("This is Bright Green", a, b, c)
cp.yellow("This is Yellow", a, b, c)
cp.yellow("This is Bright Yellow", a, b, c)
cp.blue("This is Blue", a, b, c)
cp.bright_blue("This is Bright Blue", a, b, c)
cp.magenta("This is Magenta", a, b, c)
cp.bright_magenta("This is Bright Magenta", a, b, c)
cp.cyan("This is Cyan", a, b, c)
cp.bright_cyan("This is Bright Cyan", a, b, c)
cp.white("This is White", a, b, c)
cp.bright_white("This is Bright White", a, b, c)
sys.stdout.write("\n")

cp.red("This is Red", a, b, c)
cp.green("This is Bold Green", a, b, c, bold=True)
cp.yellow("This is Bold Italic Yellow", a, b, c, bold=True, italic=True)
cp.blue("This is Bold Italic Underline Blue", a, b, c, bold=True, italic=True, underline=True)
cp.magenta(
    "This is Bold Italic Underline StrikeOut Magenta",
    a,
    b,
    c,
    bold=True,
    italic=True,
    underline=True,
    strike_out=True,
)
cp.cyan(
    "This is Bold Italic Underline Reverse Cyan", a, b, c, bold=True, italic=True, underline=True, reverse=True
)
cp.white(
    "This is Bold Italic Underline StrikeOut Reverse White",
    a,
    b,
    c,
    bold=True,
    italic=True,
    underline=True,
    strike_out=True,
    reverse=True,
)
sys.stdout.write("\n")

cp.black("This is Black", a, b, c, sep="\t\t", end="@@ \n\n", flush=True)
cp.red("This is Red", a, b, c, sep="\t\t", end="@@ \n\n", flush=True)
cp.green("This is Green", a, b, c, sep="\t\t", end="@@ \n\n", flush=True)

Development

Publishing to PyPI

This project uses GitHub Actions for automated PyPI publishing. The workflow supports both TestPyPI and PyPI deployments.

Prerequisites

  1. Set up Trusted Publishing on PyPI:

    • Go to PyPI (or TestPyPI)
    • Add a new "pending publisher" with:
      • PyPI Project Name: colorful-print
      • Owner: sanggi-wjg
      • Repository: color_print
      • Workflow: publish-pypi.yml
      • Environment: pypi (or testpypi)
  2. Configure GitHub Environments:

    • Go to repository Settings → Environments
    • Create two environments: pypi and testpypi
    • (Optional) Add protection rules for production deployment

How to Publish

  1. Go to Actions tab in GitHub
  2. Select 📦 Publish to PyPI workflow
  3. Click Run workflow
  4. Choose deployment environment:
    • testpypi: Deploy to TestPyPI only (recommended for testing)
    • pypi: Deploy to production PyPI
    • both: Deploy to TestPyPI first, then PyPI

Local Build and Test

# Install Poetry
curl -sSL https://install.python-poetry.org | python3 -

# Build the package
poetry build

# The built files will be in dist/
ls -la dist/

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

colorful_print-1.0.0.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

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

colorful_print-1.0.0-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: colorful_print-1.0.0.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.13.1 Darwin/24.6.0

File hashes

Hashes for colorful_print-1.0.0.tar.gz
Algorithm Hash digest
SHA256 97ef7f8602d1d6d2e34ee33d4d3c69af344787ba15e2e8f759596ccbb3751c06
MD5 cb67c7036d1da18d531a3546461ec70f
BLAKE2b-256 18ee5b1f03ff0ddb933a17285c8a16b647592a633201984e2a5adfd6538bcd79

See more details on using hashes here.

File details

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

File metadata

  • Download URL: colorful_print-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.13.1 Darwin/24.6.0

File hashes

Hashes for colorful_print-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4f134eb55df32cc4028be37c61b272f871f658d2ddfe355ac58b312b8df5792a
MD5 4edfb2455418ceb275282297b4c3f35b
BLAKE2b-256 e50014cdda4247c66ed56c80de9dec7d915aded5b1a047edf5dd42709631f28a

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