#!/bin/env python3 import sys import pyfarbpracht as fp def usage(): print('usage: ' + sys.argv[0] + ' \"#abcdef\" [msg]') print('You need to escape the hex color') sys.exit(1) if len(sys.argv) < 2: usage() color = sys.argv[1] if not color.startswith('#'): print('Color does not start with "#"') sys.exit(1) if len(color) != 7: print('Invalid color length') sys.exit(1) try: test = int(color[1:], 16) except: print('Color is not a valid hex string') sys.exit(1) if len(sys.argv) < 3: msg = color else: args = sys.argv[2:] msg = ' ' .join(args) fp.printc(color, msg, enable_color=True)