Skip to main content

Swag up your shell output with escape code magic!

Project description


Color your shell output with escape code magic.



pip install swag


Usage: swag [OPTIONS] COMMAND [ARGS]...

  --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.


CLI Usage

Print to the cli

You can print colored from the shell as follows:

swag print --color yellow --modifier intenseBold "This text will be intenseBold and yellow :-)"

The possible modifiers are:

  • underline
  • background
  • bold
  • intense
  • intenseBold
  • intenseBackground

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

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


This project is licensed under the GPL-3 license.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for swag, version 1.7.3
Filename, size File type Python version Upload date Hashes
Filename, size swag-1.7.3.tar.gz (16.2 kB) File type Source Python version None Upload date Hashes View
Filename, size swag-1.7.3-py3-none-any.whl (29.4 kB) File type Wheel Python version py3 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page