aboutsummaryrefslogtreecommitdiff
path: root/pyfarbpracht/pyfarbpracht.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyfarbpracht/pyfarbpracht.py')
-rwxr-xr-xpyfarbpracht/pyfarbpracht.py39
1 files changed, 23 insertions, 16 deletions
diff --git a/pyfarbpracht/pyfarbpracht.py b/pyfarbpracht/pyfarbpracht.py
index 2422699..d41842b 100755
--- a/pyfarbpracht/pyfarbpracht.py
+++ b/pyfarbpracht/pyfarbpracht.py
@@ -19,22 +19,29 @@ def printc(color, msg, no_newline=False, enable_color=False):
def colored(color, msg):
"""returns msg in ANSI color"""
ret = str()
- c = 'default'
- if color == 'red':
- c = '31'
- elif color == 'green':
- c = '32'
- elif color == 'yellow':
- c = '33'
- elif color == 'blue':
- c = '34'
- elif color == 'magenta':
- c = '35'
- elif color == 'cyan':
- c = '36'
- if c is not 'default':
- # set color
- ret += '\033[0;' + c + 'm'
+ if color.startswith("#"):
+ ret += '\033[38;2;'
+ ret += str(int(color[1:3], 16)) + ';' \
+ + str(int(color[3:5], 16)) + ';' \
+ + str(int(color[5:7], 16))
+ ret += 'm'
+ else:
+ c = 'default'
+ if color == 'red':
+ c = '31'
+ elif color == 'green':
+ c = '32'
+ elif color == 'yellow':
+ c = '33'
+ elif color == 'blue':
+ c = '34'
+ elif color == 'magenta':
+ c = '35'
+ elif color == 'cyan':
+ c = '36'
+ if c is not 'default':
+ # set color
+ ret += '\033[0;' + c + 'm'
ret += msg
# reset color
ret += '\033[0m'
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