Skip to content

Utilities to change color and style of stdout on Unix-like systems

Notifications You must be signed in to change notification settings

KamilMatejuk/Python-Text-Color

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Helper Module For Text Coloring

Defined functions:

  • color(color: str, text: str) -> set text color
  • bg_color(color: str, text: str) -> set text background color
  • style(style: str, text: str) -> set text style

Usage

Basic usage

# prints red text
print(color('red', 'some text'))

Functions can be stacked on top of each other

# prints underlined, green text on black background
print(
    style('underline',
        bg_color('black', 
            color('green',
                'some text'
            )
        )
    )
)

For commonly used cases you can define helper functions

# prints bold blue text
bb = lambda text: style('bold', color('blue', text))
print(bb('some text'))

Available Text Colors:

  • BLACK
  • RED
  • GREEN
  • YELLOW
  • BLUE
  • PURPLE
  • CYAN
  • WHITE
  • BLACK
  • RED
  • GREEN
  • YELLOW
  • BLUE
  • PURPLE
  • CYAN
  • WHITE

Available Background Colors:

  • BLACK
  • RED
  • GREEN
  • YELLOW
  • BLUE
  • PURPLE
  • CYAN
  • WHITE
  • BLACK
  • RED
  • GREEN
  • YELLOW
  • BLUE
  • PURPLE
  • CYAN
  • WHITE

Available Styles:

  • BOLD
  • UNDERLINE

Command line run output

About

Utilities to change color and style of stdout on Unix-like systems

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages