Giter Club home page Giter Club logo

pyclrs's Introduction

pyclrs

Print color on Linux or Windows terminals.


1. Install

pip install pyclrs

install



2. Functions

from pyclrs.color import Use
c = Use('Hello World')

2.1 Color

  • black
    • c.backblack() or c.foreblack
  • red
    • c.backblack() or c.foreblack
  • green
    • c.backblack() or c.foreblack
  • yellow
    • c.backblack() or c.foreblack
  • blue
    • c.backblack() or c.foreblack
  • nagebta
    • c.backblack() or c.foreblack
  • cyan
    • c.backblack() or c.foreblack
  • white
    • c.backblack() or c.foreblack

2.2 Mode

  • default
    • c.default()
  • highlight
    • c.highlight()
  • underline
    • c.underline()
  • twinkle
    • c.twinkle()
  • hide
    • c.hide()
  • excute
    • c.excute()



3. Example


3.1 Simple Use

simple

from pyclrs.color import Use

p1 = Use('Hello World')
print(p1.excute())

p2 = Use('Hello World')
p2.backred()
p2.foreblack()
print(p2.excute())

p3 = Use('Hello World')
p3.forered()
p3.twinkle()
print(p3.excute())

3.2 Check the state of server

check

from pyclrs.color import Use

title = Use('%-17s%-10s%-10s'%("Ipaddr","Server","Status"))
title.backcyan()
title.foreblack()
redis = Use('%-10s'%'Started')
redis.backwhite()
redis.foregreen()
mysql = Use('%-10s'%'Stopped')
mysql.backwhite()
mysql.forered()
mysql.twinkle()
httpd = Use('%-10s'%'Unknown')
httpd.backwhite()
httpd.foreyellow()
addr1 = Use('%-17s%-10s'%('192.168.100.100','redis'))
addr1.backwhite()
addr1.foreblack()
addr2 = Use('%-17s%-10s'%('192.168.100.101','mysql'))
addr2.backwhite()
addr2.foreblack()
addr3 = Use('%-17s%-10s'%('192.168.100.102','httpd'))
addr3.backwhite()
addr3.foreblack()

print(title.excute())
print(addr1.excute()+redis.excute())
print(addr1.excute()+mysql.excute())
print(addr1.excute()+httpd.excute())

pyclrs's People

Contributors

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