Socket
Socket
Sign inDemoInstall

colort

Package Overview
Dependencies
0
Maintainers
1
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    colort

Display colored text in the terminal.


Maintainers
1

Readme

Colort

Downloads Downloads Downloads

This module provides functions for formatting text with ANSI escape codes to add color and style.

Installation

pip install colort

Usage

from colort import colorize

The colorize function takes a string and any number of Style and *Color enums. It returns the string formatted with the specified styles.

For example:

from colorformat import colorize, ForegroundColor as fc, Style

colored_text = colorize('Hello World!', fc.GREEN, Style.BOLD)
print("colored text: ", colored_text)

This will print the text in bold and green.

截屏2023-08-06 11.03.47

The available formatting options are:

Colors

  • ForegroundColor
    • BLACK, RED, GREEN, YELLOW, BLUE, etc.
  • BackgroundColor
    • BLACK, RED, GREEN, YELLOW, BLUE, etc.

Styles

  • Style
    • NORMAL, BOLD, UNDERLINE, BLINK, INVERT, HIDE

Multiple styles can be combined:

colorize('Text', ForegroundColor.WHITE, BackgroundColor.RED, Style.BOLD)

Keywords

FAQs


Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc