A simple package to convert strings to colored strings using ANSI escape codes
Project description
zyjared-color
Reference
Installation
pip install zyjared-color
Usage
Basic Usage
Create a styled text using the Color
class:
text = Color('Hello World!').red().bold()
print(text)
You can achieve the same result using ColorStatic
class methods:
from zyjared_color import ColorStatic as Colors
text = Colors.red('Hello World!').bold()
print(text)
Or using convenience functions for styles:
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)
All Styles
You can view all styles through the ColorStatic
class method.
methods
extend(style)
clean(style)
styles
bold
dim
italic
underline
through
reverse
blink
blink_fast
hidden
frontground
black
red
green
yellow
blue
magenta
cyan
white
bright_black
bright_red
bright_green
bright_yellow
bright_blue
bright_magenta
bright_cyan
bright_white
background
bg_black
bg_red
bg_green
bg_yellow
bg_blue
bg_magenta
bg_cyan
bg_white
bg_bright_black
bg_bright_red
bg_bright_green
bg_bright_yellow
bg_bright_blue
bg_bright_magenta
bg_bright_cyan
bg_bright_white
Project details
Release history Release notifications | RSS feed
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.2.0.tar.gz
(6.8 kB
view details)
Built Distribution
File details
Details for the file zyjared_color-0.2.0.tar.gz
.
File metadata
- Download URL: zyjared_color-0.2.0.tar.gz
- Upload date:
- Size: 6.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0e8debd4d829f8da4f975a16f1540175f83e77f4e8b186fc8c56d72e436f7e4e |
|
MD5 | 1fa4fce526a98aeee82748441daa7e09 |
|
BLAKE2b-256 | c5b8209e46b77c733744e682472ebdb5be564fae65aaa0cac58824ae8209eabe |
File details
Details for the file zyjared_color-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: zyjared_color-0.2.0-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ae9a1bfa19a92dbabf54b9f19ae160c0e1cfdf2dabd511dac756e8418cb38d3 |
|
MD5 | 20a491e2d42e08d52cca7df4e3f7f0f3 |
|
BLAKE2b-256 | b44b34cd12a24719b62ad253255954ce53fb87fa933af24bfca3284143a02e36 |