changeset 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
files diff-colorize.py
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/diff-colorize.py
+++ b/diff-colorize.py
@@ -1,9 +1,11 @@
 #!/usr/bin/env python
 
-INDEX_COLOR = 32
-REMOVED_COLOR = 203
-ADDED_COLOR = 2
-HUNK_START_COLOR = 32
+import os
+
+INDEX_COLOR      = int(os.environ.get('DIFF_INDEX_COLOR', 32))
+REMOVED_COLOR    = int(os.environ.get('DIFF_REMOVED_COLOR', 203))
+ADDED_COLOR      = int(os.environ.get('DIFF_ADDED_COLOR', 2))
+HUNK_START_COLOR = int(os.environ.get('DIFF_HUNK_START_COLOR', 32))
 
 RESET_FORMAT = '\033[0m'
 COLOR_FORMAT = '\033[38;5;%um'