Popularity
0.6
Stable
Activity
0.0
Stable
11
2
0

Description

Escape is a very simple terminal styling library largely inspired by the excellent javascript chalk library. There are other terminal styling libraries such as colorama available but they do not offer a simple composable API like escape does. Escape is pure python, does not have any external dependencies and should work right out of the box. Escape has been tested to work with python 2.7 and python 3.6. Escape has not been tested on Windows

Programming language: Python
License: MIT License
Latest version: v1.1

escape alternatives and similar packages

Based on the "Command-line Application Development" category.
Alternatively, view escape alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of escape or a related project?

Add another 'Command-line Application Development' Package

README

Build Status

escape

Escape is a very simple terminal styling library largely inspired by the excellent javascript chalk library. There are other terminal styling libraries such as colorama available but they do not offer a simple composable API like escape does. Escape is pure python, does not have any external dependencies and should work right out of the box. Escape has been tested to work with python 2.7 and python 3.6. Escape has not been tested on Windows

Install

pip install escape

Usage

from escape import Escape

print(Escape('Hello World').red())

# combine styled strings
print(Escape('Hello').bright_green() + Escape(' World!').bright_red())

# combibe styled and normal string
print(Escape('Hello').bright_magenta() + ' World!')

# compose multiple styles together
print(Escape('Hello World').bright_red().underline().bright_yellow_background())

# Nest styles
Escape('Hello ', Escape('World').bright_green_background()).bright_red()

Escape('Hello ' +  Escape('World').bright_green_background()).bright_red()

Preview how styling looks on your terminal

from escape import palette
palette()

[alt tag](media/palette.png)

Styles

Modifiers

  • bold
  • dim
  • hidden
  • inverse
  • italic
  • strikethrough
  • underline

Colors

  • black
  • red
  • green
  • yellow
  • blue
  • magenta
  • cyan
  • white
  • gray
  • bright_red
  • bright_green
  • bright_yellow
  • bright_blue
  • bright_magenta
  • bright_cyan
  • bright_white

Background Colors

  • black_background
  • red_background
  • green_background
  • yellow_background
  • blue_background
  • magenta_background
  • cyan_background
  • white_background
  • bright_black_background
  • bright_red_background
  • bright_green_background
  • bright_yellow_background
  • bright_blue_background
  • bright_magenta_background
  • bright_cyan_background
  • bright_white_background