diff options
Diffstat (limited to 'pyfarbpracht/printc.py')
-rwxr-xr-x | pyfarbpracht/printc.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/pyfarbpracht/printc.py b/pyfarbpracht/printc.py new file mode 100755 index 0000000..3ac38a2 --- /dev/null +++ b/pyfarbpracht/printc.py @@ -0,0 +1,30 @@ +#!/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) + +msg = sys.argv[2] + +fp.printc(color, msg, enable_color=True) |