Beautify your command line interfaces
Project description
Basics
Install:
pip install iridi
Usage:
import iridi
# Create gradient text
# iridi.print(message, colors, options)
# Ask for input with gradient text:
# iridi.input(message, colors, options)
iridi.print("This is an example message. Colorful, huh?", ["#8A2387", "#E94057", "#F27121"], bold=True)
response = iridi.input("What's your favorite color?", ["#8A2387", "#E94057", "#F27121"])
print(response)
The above should result in this:
Presets
There are included presets when importing the module, access them by doing iridi.presets.[name]
. Example:
import iridi
iridi.print("Nice preset!", iridi.presets.wiretap)
If you'd like to contribute or add official preset gradients to this project, feel free to fork this and make a PR!
Make your own presets:
Iridi comes with the ability to create your own gradients and reuse them.
gradient = iridi.preset(["#D3959B", "#BFE6BA"])
gradient.print("Testing with preset constructors.", bold=True)
response = gradient.input("Test an input: ")
print(response)
Output:
Options:
The array can be an array of hex strings, or objects with r, g, and b values. This...
# This works:
iridi.print("Try it with RGB objects next!", ["#7350b3", "#2ebf91"])
# So does this:
iridi.print("Try it with hex values if you haven't!", [{"r": 250, "g": 0, "b": 100}, {"r": 60, "g": 255, "b": 0}])
...results in the following:
Want the output in bold? No problem, just add bold=True
as the third argument to the function (shown in examples above).
If you end up using this, or just think it's cool, feel free to :star: this repo, it means a lot :)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.