DiffColorizer
API reference › Scaffold › Console › DiffColorizer
Colors unified diff lines with raw ANSI escape codes: the first two lines (file headers) in bold, hunk headers in cyan, added lines in green and removed lines in red.
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
colorize() | Colors a unified diff whose first two lines are the --- and +++ file headers. | DiffColorizer |
Method details
Section titled “Method details”colorize()
Section titled “colorize() ”public function colorize(string $diff): stringColors a unified diff whose first two lines are the --- and +++ file headers.
Parameters
| Parameter | Type | Description |
|---|---|---|
$diff | string | Unified diff with "\ line separators. |
Returns
string: Diff with each styled line wrapped in ANSI escape codes; context lines stay unstyled.