def debug_colors(*num): args = list(num) print_bar('debug colors') for i, num in enumerate(args): sti=str(num) stderr( "{}{:^5}{}".format( Swatch(name=sti, bg=num),sti,const.RESET) ) stderr(const.RESET)
def debug_styles(styles): print_bar('debug styles') #print(styles) #args = list(styles) #print(args) for key, val in styles.items(): stderr( "{}{:^5}{}{}".format( val,key,const.RESET, const.NL) ) stderr(const.RESET)
def debug_colors256(): print_bar('256 colors') for i in range(0, 16): for j in range(0, 16): code = str(i * 16 + j) stderr( "{}{:^5}".format( Swatch(name=str(code), bg=code),code) ) eprint(const.RESET) stderr(const.RESET)
def unit_test(): try: print_bar('Console Test') debug('try debug') info('try info') warn('try warn') err('try err') ok('try ok') silly('try silly') return 0 except KeyboardInterrupt: info('\nDone')
def unit_test(): try: debug_colors256() debug_colors(1,2,12,57,167) debug_styles(rainbow_const_fg.list()) #pretty(rainbow_const_fg.list()) style1 = Swatch(name='coolred',fg=9,bg=0) style2 = Swatch(name='banana',fg=None,bg=220,attr=5) style3 = Swatch(name='sea',fg=None,bg=6,attr=5) print( style1, style1.name, const.RESET, repr(str(style1))) print( style2, style2.name, const.RESET, repr(str(style2))) print( style3, style3.name, const.RESET, repr(str(style3))) print_bar( 'sea bar!', style3 ) except KeyboardInterrupt: info('\nDone')