Skip to main content

Personal font color utility library for Python

Project description

zyjared-color

Personal font color utility library for Python, primarily used in PowerShell.

Installation

pip install zyjared-color

Usage

Basic Usage

Create a styled text using the Color class:

from zyjared_color import Color

text = Color('Hello World!').red().bold()
print(text)

You can achieve the same result using StaticColor class methods:

from zyjared_color import StaticColor as Colors

text = Colors.red('Hello World!').bold()
print(text)

Or using aliases:

from zyjared_color import red, bold, italic

text = red('Hello World!').bold()
print(text)

text = italic(text)
print(text)

Chaining Usage

You can chain multiple style methods together:

from zyjared_color import red

text = red('Hello World!').bold().italic().underline().through()
print(text)

Nested Usage

Combine different styling methods and functions:

from zyjared_color import red, bold, italic, underline, through, blue

text = through(underline(italic(bold(red('Hello World!')))))
print(text)

# add more text
text = text + ' !!! ' + blue('Hello World!')
print(text)

# change text color
text.yellow()
print(text)

HTML / CSS

from zyjared_color.html import ColorHtml as Color, StaticColorHtml as StaticColor
from zyjared_color.html import blue, red, bold, italic, underline, through

text = ColorHtml('Hello World!').red().bold()
print(text)

# custom styles
text = ColorHtml("Hello World!", {"opacity": 0.5, "font-weight": "bold"})
print(text)

example: Display ColorHtml in Jupyter Notebook

from zyjared_color.html import ColorHtml as Color, StaticColorHtml as StaticColor
from zyjared_color.html import blue, red, bold, italic, underline, through
from IPython.display import display, HTML

text = Color('Hello World!').red().bold()

# f'{text}' or str(text)
display(HTML(f'{text}'))

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

zyjared_color-0.4.0.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

zyjared_color-0.4.0-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file zyjared_color-0.4.0.tar.gz.

File metadata

  • Download URL: zyjared_color-0.4.0.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.4 Linux/6.5.0-1025-azure

File hashes

Hashes for zyjared_color-0.4.0.tar.gz
Algorithm Hash digest
SHA256 a7c6904cc4533accf7f098f0672703c21d6d9767ea0438d66f8eff370e0b7b9a
MD5 b82ac0cdcd6e217b1360ff640344bdb8
BLAKE2b-256 0c46306a3eef1f01b86d5eb3c85f679e0dabd5fb39c8746c87295164141a2135

See more details on using hashes here.

File details

Details for the file zyjared_color-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: zyjared_color-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.4 Linux/6.5.0-1025-azure

File hashes

Hashes for zyjared_color-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 861bcb2c36a09e1776a162e2227f0e9436c261488ddfe51e088c29b12da57804
MD5 5251a1be7e5a808f70213ef0f2c2d854
BLAKE2b-256 55b5ae28c0c29184dfd9c9f7fbef97e8e6afe729c5d44c0c6e82fddfde85f97c

See more details on using hashes here.

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