from libcolors import color C_RESET = color() C_FATAL = color("red") C_WARN = color("yellow") C_KEYLEN = color("green") C_PROB = color("white", attrs="") C_BEST_KEYLEN = color("green", attrs="bold") C_BEST_PROB = color("white", attrs="bold") C_DIV = color(attrs="bold") C_KEY = color("red", attrs="bold") C_BOLD = color(attrs="bold") C_COUNT = color("yellow", attrs="bold") COLORS = { 'C_RESET': C_RESET, 'C_FATAL': C_FATAL, 'C_WARN': C_WARN, 'C_KEYLEN': C_KEYLEN, 'C_PROB': C_PROB, 'C_BEST_KEYLEN': C_BEST_KEYLEN, 'C_BEST_PROB': C_BEST_PROB, 'C_DIV': C_DIV, 'C_KEY': C_KEY, 'C_BOLD': C_BOLD, 'C_COUNT': C_COUNT, }
#!/usr/bin/env python #-*- coding:utf-8 -*- from libcolors import color C_RESET = color() C_FATAL = color("white", "red") C_WARN = color("yellow") C_KEYLEN = color("green") C_PROB = color("white", attrs="") C_BEST_KEYLEN = color("green", attrs="bold") C_BEST_PROB = color("white", attrs="bold") C_DIV = color(attrs="bold") C_KEY = color("red", attrs="bold") C_BOLD = color(attrs="bold") C_COUNT = color("yellow", attrs="bold")
def _main(): header = color("white", "black", "dark") print print header + " " + "Colors and backgrounds: " + color() for c in _keys_sorted_by_values(BASH_COLORS): c1 = color(c) c2 = color("white" if c != "white" else "black", bgcolor=c) print( c.ljust(10) + c1 + "colored text" + color() + " " + c2 + "background" + color()) print print header + " " + "Attributes: " + color() for c in _keys_sorted_by_values(BASH_ATTRIBUTES): c1 = color("red", attrs=c) c2 = color("white", attrs=c) print( c.ljust(13) + c1 + "red text" + color() + " " + c2 + "white text" + color()) print return
def _main(): header = color("white", "black", "dark") print print header + " " + "Colors and backgrounds: " + color() for c in _keys_sorted_by_values(BASH_COLORS): c1 = color(c) c2 = color("white" if c != "white" else "black", bgcolor=c) print (c.ljust(10) + c1 + "colored text" + color() + " " + c2 + "background" + color()) print print header + " " + "Attributes: " + color() for c in _keys_sorted_by_values(BASH_ATTRIBUTES): c1 = color("red", attrs=c) c2 = color("white", attrs=c) print (c.ljust(13) + c1 + "red text" + color() + " " + c2 + "white text" + color()) print return