Print color text using escape codes
(text, sameline=False, colour="default")
| 34 | |
| 35 | |
| 36 | def printcolour(text, sameline=False, colour="default"): |
| 37 | """ |
| 38 | Print color text using escape codes |
| 39 | """ |
| 40 | sep = '' if sameline else '\n' |
| 41 | |
| 42 | # If no colour set, do not print color ESC characters |
| 43 | if get_colour(colour) == get_colour("ENDC"): |
| 44 | sys.stdout.write(text + sep) |
| 45 | else: |
| 46 | sys.stdout.write(get_colour(colour) + text + get_colour("ENDC") + sep) |
| 47 | |
| 48 | |
| 49 | def drange(start, stop, step=1.0, include_stop=False): |
no test coverage detected