A CLI for maxludden/maxgradient
Project description
MaxGradient automates the printing gradient colored text to the console. It's built upon the great rich library. It contains a Console that can serve as a drop in replacement for rich.rich.Console and has an expanded Color class which can parse X11 color names on top of rich's standard colors. MaxGradient is a work in progress and I'm open to any suggestions or contributions.
Installation
MaxGradient can be installed from PyPi using your favorite package manager:
PDM (Recommended)
pdm add maxgradient
Pip
pip install maxgradient
Usage
Basic Usage
The basic usage is to create a console object and use it to print gradient text:
import maxgradient as mg
console = mg.Console()
console.gradient("Hello, World!")
Gradient
You may also instantiate a Gradient Object. The Gradient class is a subclass of the rich.text.Text class, and can be used in the same way. The Gradient class has a few extra arguments available though.
class Gradient(rich.rich.Text):
"""Text with gradient color / style."""
def __init__ (
ext: Optional[str | Text] = "",
colors: Optional[str|List[Color | Tuple | str]] = None,
rainbow: bool = False,
invert: bool = False,
hues: Optional[int] = None,
color_sample: bool = False,
style: StyleType = Style.null(),
*,
# The arguments below are used directly by Text
# so I won't cover them here. If you have
# questions check out the rich documentation.
justify: Optional[JustifyMethod] = None,
overflow: Optional[OverflowMethod] = None,
no_wrap: Optional[bool] = None,
end: str = "\n",
tab_size: Optional[int] = 8,
spans: Optional[List[Span]] = None,) -> None:
The Gradient class can utilize the above arguments to get a plethora of different gradients.
Color
The final main component of MaxGradient is expanding the rich.color.Color class. The MaxGradient .Color class can still parse and utilize the rich.color.Color's standard colors but in addition to Hex and RGB colors, it can also parse RGB Tuples as well as X11 color names. I've also included the colors that MaxGradient uses to create random gradients from for convenience. The follow are the available named colors as well as there hex and rgb colors:
Color Examples
import maxgradient as mg
console = mg.Console()
console.print("[bold green]This is a a vibrant green color!")
Changelog v1.0.6
- Added docs
- Changed docs to readthedocs theme.
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
Built Distribution
File details
Details for the file gradient_cli-0.1.9.tar.gz
.
File metadata
- Download URL: gradient_cli-0.1.9.tar.gz
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.9.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 56865c6626d3cec3b06080937d94352450b767a846cba69f1c966cdbf51af348 |
|
MD5 | ceaf19969d1d976e7c62983606d2ff18 |
|
BLAKE2b-256 | 28f809292532f579d7aafc08c0b6227268cced20f037016bcdf0b0912c6466db |
File details
Details for the file gradient_cli-0.1.9-py3-none-any.whl
.
File metadata
- Download URL: gradient_cli-0.1.9-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.9.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 078f4aaf2acd9c28be0b751cf4e790442c5ca5271995136cd4b8a91090d79477 |
|
MD5 | 7c2503db5fd28d73b4655fca6797d198 |
|
BLAKE2b-256 | 9c47b18df1a2b79dfa41d50a596640d180578e59d7430f9c2484f9262c1af706 |