Swag
Color your shell output with escape code magic.
Installation
pip install swag
Usage
Usage: swag [OPTIONS] COMMAND [ARGS]...
Options:
--install-completion [bash|zsh|fish|powershell|pwsh]
Install completion for the specified shell.
--show-completion [bash|zsh|fish|powershell|pwsh]
Show completion for the specified shell, to
copy it or customize the installation.
--help Show this message and exit.
Commands:
install
list
print
CLI Usage
Print to the cli
You can print colored from the shell as follows:
swag print --color yellow --modifier intense_bold "This text will be intense_bold and yellow :-)"
The possible modifiers are:
- underline
- background
- bold
- intense
- intense_bold
- intense_background
Installation to a folder
From the commandline do:
swag install --dest <path/to/folder> # default is ~/.colors
This will install all the escape codes to the ~/.colors or <path/to/folder> folder.
Now you can use the colors directly from the console via:
echo $(cat ~/.colors/blue) This will be blue
List all colors
Prints a list of colors (color coded).
swag list
Use from code
Print to the console
from swag import red, green, reset, INTENSE
red("This will be red")
green("Blah", modifier=INTENSE) # Prints an intense green
# Prints an intense green, to the end of the output, means if you use print after it will be green too:
green("This is green until the end", modifier=INTENSE, continuous=True)
print("This will still be green")
reset() # From now on the default cli color will be used
Use the colors in a string
from swag import colors
print(f"{colors.red}This will be red{colors.reset}")
License
This project is licensed under the GPL-3 license.
Metadata
Release files for swag 2.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| swag-2.0.5.tar.gz | 16.1 kB | Without provenance | Details for swag-2.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| swag-2.0.5-py3-none-any.whl | Python 3 | none | any | Details for swag-2.0.5-py3-none-any.whl |
Total release size: 45.8 kB
Release files / swag-2.0.5.tar.gz
| Download URL | swag-2.0.5.tar.gz |
|---|---|
| Size | 16.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cd5b2aed541107ffa657d5e21e4b50482f0f7489c452726fb07cfa1e80e615d2
|
|
BLAKE2b-256 checksum How to use checksums |
608ceef58ffc3ab296ecc8489a8a362ee25a12267786c27350b35a0b302660d9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.11.4 Linux/5.15.0-121-generic
|
Release files / swag-2.0.5-py3-none-any.whl
| Download URL | swag-2.0.5-py3-none-any.whl |
|---|---|
| Size | 29.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
efadd2bc0061a6e95e2d74651b36619c97deb6b9b9646a64ad95cb135ed6581a
|
|
BLAKE2b-256 checksum How to use checksums |
adc35beed1d0b3c7f3a8f82808256c435171c8dbc778cec56c17e91370751688
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.11.4 Linux/5.15.0-121-generic
|
Security for swag 2.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.