diff --git a/src/applications/differential/editor/DifferentialTransactionEditor.php b/src/applications/differential/editor/DifferentialTransactionEditor.php --- a/src/applications/differential/editor/DifferentialTransactionEditor.php +++ b/src/applications/differential/editor/DifferentialTransactionEditor.php @@ -1827,8 +1827,30 @@ } private function renderPatchHTMLForMail($patch) { + $patch_html_lines = array(); + foreach (phutil_split_lines($patch) as $line) { + $len = strlen($line); + $color = null; + if ($len >= 1 && $line[0] == '+') { + $color = 'green'; + } else if ($len >= 1 && $line[0] == '-') { + $color = 'red'; + } else if ($len >= 2 && substr($line, 0, 2) == '@@') { + $color = 'purple'; + } + + $attrib = array(); + + if ($color) { + $attrib['style'] = "color:{$color};"; + } + + $patch_html_lines[] = phutil_tag('span', $attrib, $line); + } + return phutil_tag('pre', - array('style' => 'font-family: monospace;'), $patch); + array('style' => 'font-family: monospace;'), + $patch_html_lines); } private function renderPatchForMail(DifferentialDiff $diff) {