Code Monkey home page Code Monkey logo

tcolorpy's Introduction

Summary

tcolopy is a Python library to apply true color for terminal text.

PyPI package version conda-forge package version Supported Python versions Supported Python implementations Linux/macOS/Windows CI status Test coverage: coveralls

Installation

Installation: pip

pip install tcolorpy

Installation: conda

conda install -c conda-forge tcolorpy

Usage

Library usage

Sample Code:
from tcolorpy import tcolor

print(tcolor("tcolopy example", color="#ee1177", styles=["bold", "italic", "underline"]))
Output:
https://github.com/thombashi/tcolorpy/blob/master/ss/oneline.png

You can set the following tcolor arguments:

  • color/bg_color
    • color names ("red", "red", etc.) or color code ("#RRGGBB")
  • styles
    • "bold", "italic", etc.

Other examples

Apply true color and styles to text:

You can also specify colors by names:

CLI usage

tcolorpy can be used via CLI:

$ python -m tcolorpy "tcolopy example" -c "#ee1177" -s bold,italic,underline

Command help

usage: __main__.py [-h] [-c COLOR] [-b BG_COLOR] [-s STYLES] [--encode ENCODE]
                   string

positional arguments:
  string                string to apply styles.

optional arguments:
  -h, --help            show this help message and exit
  -c COLOR, --color COLOR
                        specify a color code (#XXXXXX) or a name. valid names
                        are: black, red, green, yellow, blue, magenta, cyan,
                        white, lightblack, lightred, lightgreen, lightyellow,
                        lightblue, lightmagenta, lightcyan, lightwhite
  -b BG_COLOR, --bg-color BG_COLOR
                        specify a background color code (#XXXXXX) or a name.
                        valid names are: black, red, green, yellow, blue,
                        magenta, cyan, white, lightblack, lightred,
                        lightgreen, lightyellow, lightblue, lightmagenta,
                        lightcyan, lightwhite
  -s STYLES, --styles STYLES
                        specify a comma separated styles. valid values are:
                        bold, dim, italic, underline, blink, invert, strike
  --encode ENCODE       output a text encoded with the specified encoding

Dependencies

Python 3.6+ No external dependencies.

tcolorpy's People

Contributors

thombashi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.