Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python style console output

class colors:
    '''Colors class:
    reset all colors with colors.reset
    two subclasses fg for foreground and bg for background.
    use as colors.subclass.colorname.
    i.e. colors.fg.red or colors.bg.green
    also, the generic bold, disable, underline, reverse, strikethrough,
    and invisible work with the main class
    i.e. colors.bold
    '''
    reset='33[0m'
    bold='33[01m'
    disable='33[02m'
    underline='33[04m'
    reverse='33[07m'
    strikethrough='33[09m'
    invisible='33[08m'
    class fg:
        black='33[30m'
        red='33[31m'
        green='33[32m'
        orange='33[33m'
        blue='33[34m'
        purple='33[35m'
        cyan='33[36m'
        lightgrey='33[37m'
        darkgrey='33[90m'
        lightred='33[91m'
        lightgreen='33[92m'
        yellow='33[93m'
        lightblue='33[94m'
        pink='33[95m'
        lightcyan='33[96m'
    class bg:
        black='33[40m'
        red='33[41m'
        green='33[42m'
        orange='33[43m'
        blue='33[44m'
        purple='33[45m'
        cyan='33[46m'
        lightgrey='33[47m'
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #style #console #output
ADD COMMENT
Topic
Name
6+8 =