comparison diff-colorize.py @ 4:b8b2d1931a9e

Get our color constants from the environment, if possible.
author Peter Hosey
date Sun, 10 Aug 2008 23:33:22 -0700
parents 10948e4fd070
children fa7cd4c2716b
comparison
equal deleted inserted replaced
3:10948e4fd070 4:b8b2d1931a9e
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 2
3 INDEX_COLOR = 32 3 import os
4 REMOVED_COLOR = 203 4
5 ADDED_COLOR = 2 5 INDEX_COLOR = int(os.environ.get('DIFF_INDEX_COLOR', 32))
6 HUNK_START_COLOR = 32 6 REMOVED_COLOR = int(os.environ.get('DIFF_REMOVED_COLOR', 203))
7 ADDED_COLOR = int(os.environ.get('DIFF_ADDED_COLOR', 2))
8 HUNK_START_COLOR = int(os.environ.get('DIFF_HUNK_START_COLOR', 32))
7 9
8 RESET_FORMAT = '\033[0m' 10 RESET_FORMAT = '\033[0m'
9 COLOR_FORMAT = '\033[38;5;%um' 11 COLOR_FORMAT = '\033[38;5;%um'
10 BEGIN_REVERSE_FORMAT = '\033[7m' 12 BEGIN_REVERSE_FORMAT = '\033[7m'
11 END_REVERSE_FORMAT = '\033[27m' 13 END_REVERSE_FORMAT = '\033[27m'