# HG changeset patch # User Peter Hosey # Date 1218436402 25200 # Node ID b8b2d1931a9ea5005bfb86c4caa82c44e235094a # Parent 10948e4fd07037052f0812d5e738ad409f235451 Get our color constants from the environment, if possible. diff --git a/diff-colorize.py b/diff-colorize.py --- 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'