@@ -1112,8 +1112,9 @@ def unified_diff(a, b, fromfile='', tofile='', fromfiledate='',
11121112 For inputs that do not have trailing newlines, set the lineterm
11131113 argument to "" so that the output will be uniformly newline free.
11141114
1115- Set *color* to ``True`` to inject ANSI color codes and make the output
1116- look like what ``git diff --color`` shows.
1115+ Set *color* to ``True`` to enable output in color, similar to
1116+ :program:`git diff --color`. Even if enabled, it can be
1117+ :ref:`controlled using environment variables <using-on-controlling-color>`.
11171118
11181119 The unidiff format normally has a header for filenames and modification
11191120 times. Any or all of these may be specified using strings for
@@ -1150,13 +1151,13 @@ def unified_diff(a, b, fromfile='', tofile='', fromfiledate='',
11501151 started = True
11511152 fromdate = '\t {}' .format (fromfiledate ) if fromfiledate else ''
11521153 todate = '\t {}' .format (tofiledate ) if tofiledate else ''
1153- yield '{ }--- {}{}{}{}' . format ( t . header , fromfile , fromdate , lineterm , t . reset )
1154- yield '{ }+++ {}{}{}{}' . format ( t . header , tofile , todate , lineterm , t . reset )
1154+ yield f' { t . header } --- { fromfile } { fromdate } { lineterm } { t . reset } '
1155+ yield f' { t . header } +++ { tofile } { todate } { lineterm } { t . reset } '
11551156
11561157 first , last = group [0 ], group [- 1 ]
11571158 file1_range = _format_range_unified (first [1 ], last [2 ])
11581159 file2_range = _format_range_unified (first [3 ], last [4 ])
1159- yield '{ }@@ -{} +{} @@{}{}' . format ( t . hunk , file1_range , file2_range , lineterm , t . reset )
1160+ yield f' { t . hunk } @@ -{ file1_range } +{ file2_range } @@{ lineterm } { t . reset } '
11601161
11611162 for tag , i1 , i2 , j1 , j2 in group :
11621163 if tag == 'equal' :
0 commit comments