Skip to main content

Personal font color utility library for Python

Project description

zyjared-color

Personal font color utility library for Python.

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

text = StaticColor.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, StaticColorHtml
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.2.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

zyjared_color-0.4.2-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: zyjared_color-0.4.2.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.2.tar.gz
Algorithm Hash digest
SHA256 3c3c60316964f8e4a62d91ac500c7d6ac48fa969737b8c0395aff10e4998384b
MD5 b26df9ef7afbb9daab820dca62883287
BLAKE2b-256 629a6a6a34b655186eba6dbf13f753ee8a1c94981ac982eec7e7293b34b396ca

See more details on using hashes here.

File details

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

File metadata

  • Download URL: zyjared_color-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 11.0 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f9382062532cd7940ce93ec55db6dea5ebd92c855b8362077603eb162d6fa594
MD5 bab58a2c26f2b3d12153280c05357293
BLAKE2b-256 d99baa0461963fd40fbbe544abb9332a25f0cdb5af93316728118313f5f83d02

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