Skip to main content

A simple package to convert strings to colored strings using ANSI escape codes

Project description

zyjared-color

Reference

Installation

pip install zyjared-color

Usage

from zyjared_color import Color

a = Color.red('Hello World!')
print(a)

b = Color.bold('Hello World!').italic().underline().bg_blue()
print(b)

c = Color.red('Hello') + ' ' + Color.blue('World') + '!!!'
print(c)

d = Color('extend styles').extend(a)
print(d)

e = b.clean().red()
print(e)

f = Color.extend(e)

Color

The Color class provides static methods that return instances of the Style class.

Style class

The static methods of the Color class are designed to create and return instances of the Style class. Each method in the Color class returns a Style instance, which can then be used for further manipulation.

  • Color( text: str ) -> Instance[Style]
  • Style( text: str | None = ... ) -> Instance[Style]

methods

  • Color.extend( style: Style )
  • Color.clean( style: Style )

styles

  • Color.bold( text: str )
  • Color.italic( text: str )
  • Color.underline( text: str )
  • Color.dim( text: str )
  • Color.through( text: str )
  • Color.reverse( text: str )
  • Color.blink( text: str )
  • Color.blink_fast( text: str )
  • Color.hidden( text: str )

foreground

  • Color.black( text: str )
  • Color.red( text: str )
  • Color.green( text: str )
  • Color.yellow( text: str )
  • Color.blue( text: str )
  • Color.magenta( text: str )
  • Color.cyan( text: str )
  • Color.white( text: str )
  • Color.bright_black( text: str )
  • Color.bright_red( text: str )
  • Color.bright_green( text: str )
  • Color.bright_yellow( text: str )
  • Color.bright_blue( text: str )
  • Color.bright_magenta( text: str )
  • Color.bright_cyan( text: str )
  • Color.bright_white( text: str )

background

  • Color.bg_black( text: str )
  • Color.bg_red( text: str )
  • Color.bg_green( text: str )
  • Color.bg_yellow( text: str )
  • Color.bg_blue( text: str )
  • Color.bg_magenta( text: str )
  • Color.bg_cyan( text: str )
  • Color.bg_white( text: str )
  • Color.bg_bright_black( text: str )
  • Color.bg_bright_red( text: str )
  • Color.bg_bright_green( text: str )
  • Color.bg_bright_yellow( text: str )
  • Color.bg_bright_blue( text: str )
  • Color.bg_bright_magenta( text: str )
  • Color.bg_bright_cyan( text: str )
  • Color.bg_bright_white( text: str )

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.1.6.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

zyjared_color-0.1.6-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: zyjared_color-0.1.6.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.1

File hashes

Hashes for zyjared_color-0.1.6.tar.gz
Algorithm Hash digest
SHA256 6311bb867ca40d9c3fecc2462d3c7c251951c3be9128f80ff9eeec5c4252b217
MD5 d6e9460ba88a179f867a3d1fc211b8f4
BLAKE2b-256 8932fd19ef8e193eac55db21d9980ea027512858d0bfdf2dc4fdd658ad0240ad

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zyjared_color-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 6e9ce71ed2f4eef05d5f3870607f49d512d8bbc8fad96d926f7147ec98422bda
MD5 1094b008962053809e945c60ff6a17c4
BLAKE2b-256 43e64c2db8dc5454c4f1dabf3ee190a1db87f2ceeea4019d255fc5f6abbfe50a

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