<s> from __future__ import print_function <EOL> """<STR_LIT>""" <EOL> ( <EOL> BLACK , <EOL> RED , <EOL> GREEN , <EOL> YELLOW , <EOL> BLUE , <EOL> MAGENTA , <EOL> CYAN , <EOL> LIGHT_GRAY , <EOL> DARK_GRAY , <EOL> BRIGHT_RED , <EOL> BRIGHT_GREEN , <EOL> BRIGHT_YELLOW , <EOL> BRIGHT_BLUE , <EOL> BRIGHT_MAGENTA , <EOL> BRIGHT_CYAN , <EOL> WHITE , <EOL> ) = range ( <NUM_LIT:16> ) <EOL> def rgb ( red , green , blue ) : <EOL> """<STR_LIT>""" <EOL> return <NUM_LIT:16> + ( red * <NUM_LIT> ) + ( green * <NUM_LIT:6> ) + blue <EOL> def gray ( value ) : <EOL> """<STR_LIT>""" <EOL> return <NUM_LIT> + value <EOL> def set_color ( fg = None , bg = None ) : <EOL> """<STR_LIT>""" <EOL> print ( _set_color ( fg , bg ) , end = '<STR_LIT>' ) <EOL> def _set_color ( fg = None , bg = None ) : <EOL> result = '<STR_LIT>' <EOL> if fg : <EOL> result += '<STR_LIT>' % fg <EOL> if bg : <EOL> result += '<STR_LIT>' % bg <EOL> return result <EOL> def reset_color ( ) : <EOL> """<STR_LIT>""" <EOL> print ( _reset_color ( ) , end = '<STR_LIT>' ) <EOL> def _reset_color ( ) : <EOL> return '<STR_LIT>' <EOL> def print_color ( * args , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> fg = kwargs . pop ( '<STR_LIT>' , None ) <EOL> bg = kwargs . pop ( '<STR_LIT>' , None ) <EOL> set_color ( fg , bg ) <EOL> print ( * args , ** kwargs ) <EOL> reset_color ( ) <EOL> def format_color ( string , fg = None , bg = None ) : <EOL> return _set_color ( fg , bg ) + string + _reset_color ( ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> print ( '<STR_LIT>' ) <EOL> for c in range ( <NUM_LIT:8> ) : <EOL> print_color ( '<STR_LIT:U+0020>' , bg = c , end = '<STR_LIT>' ) <EOL> print ( ) <EOL> for c in range ( <NUM_LIT:8> , <NUM_LIT:16> ) : <EOL> print_color ( '<STR_LIT:U+0020>' , bg = c , end = '<STR_LIT>' ) <EOL> print ( ) <EOL> print ( ) <EOL> print ( '<STR_LIT>' ) <EOL> for green in range ( <NUM_LIT:6> ) : <EOL> for red in range ( <NUM_LIT:6> ) : <EOL> for blue in range ( <NUM_LIT:6> ) : <EOL> print_color ( '<STR_LIT:U+0020>' , bg = rgb ( red , green , blue ) , end = '<STR_LIT>' ) <EOL> print ( '<STR_LIT:U+0020>' , end = '<STR_LIT>' ) <EOL> print ( ) <EOL> print ( ) <EOL> print ( '<STR_LIT>' ) <EOL> for value in range ( <NUM_LIT> ) : <EOL> print_color ( '<STR_LIT:U+0020>' , bg = gray ( value ) , end = '<STR_LIT>' ) <EOL> print ( ) <EOL> print_color ( '<STR_LIT:U+0020>' , bg = rgb ( <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> ) , end = '<STR_LIT>' ) <EOL> print ( '<STR_LIT:U+0020>' * <NUM_LIT:7> , end = '<STR_LIT>' ) <EOL> print_color ( '<STR_LIT:U+0020>' , bg = rgb ( <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:1> ) , end = '<STR_LIT>' ) <EOL> print ( '<STR_LIT:U+0020>' * <NUM_LIT:2> , end = '<STR_LIT>' ) <EOL> print_color ( '<STR_LIT:U+0020>' , bg = rgb ( <NUM_LIT:2> , <NUM_LIT:2> , <NUM_LIT:2> ) , end = '<STR_LIT>' ) <EOL> print ( '<STR_LIT:U+0020>' * <NUM_LIT:2> , end = '<STR_LIT>' ) <EOL> print_color ( '<STR_LIT:U+0020>' , bg = rgb ( <NUM_LIT:3> , <NUM_LIT:3> , <NUM_LIT:3> ) , end = '<STR_LIT>' ) <EOL> print ( '<STR_LIT:U+0020>' * <NUM_LIT:2> , end = '<STR_LIT>' ) <EOL> print_color ( '<STR_LIT:U+0020>' , bg = rgb ( <NUM_LIT:4> , <NUM_LIT:4> , <NUM_LIT:4> ) , end = '<STR_LIT>' ) <EOL> print ( '<STR_LIT:U+0020>' , end = '<STR_LIT>' ) <EOL> print_color ( '<STR_LIT:U+0020>' , bg = rgb ( <NUM_LIT:5> , <NUM_LIT:5> , <NUM_LIT:5> ) , end = '<STR_LIT>' ) <EOL> print ( ) </s>
