aboutsummaryrefslogtreecommitdiff
path: root/pyfarbpracht/printc.py
blob: 28e5dd6bb02293e57f6370aa238e1341c161f6ed (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/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)
in each repos: see "about"-tab (if existing) for more details / README.
mailto contact at omeckman dot net
all timestamps in UTC (German winter time: UTC+01:00, summer time: UTC+02:00)
dark theme is a modded version of: https://gist.github.com/Yoplitein/f4b671a2ec70c9e743fa