--- a/pgtools/pgdiff.py Wed Jul 20 10:54:07 2011 +0200
+++ b/pgtools/pgdiff.py Wed Aug 10 18:34:54 2011 +0200
@@ -29,18 +29,18 @@
class DiffBase:
+ COLORS = {
+ '+' : BOLD | GREEN,
+ '-' : BOLD | RED,
+ '*' : BOLD | YELLOW}
+
def __init__(self):
self.changes = None
def format(self):
out = [' ' * self.level]
- if self.change == '+':
- out.append(highlight(1, BOLD | GREEN))
- elif self.change == '-':
- out.append(highlight(1, BOLD | RED))
- else:
- out.append(highlight(1, BOLD | YELLOW))
+ out.append(highlight(1, self.COLORS[self.change]))
out.append(self.change)
out += [' ', self.type, ' ', self.name, highlight(0)]