Colorize a diff in unified format
Perl 5 (-p), 70, 69 bytes
-1 byte dropping 0, as suggested by Dom Hastings

s/^([-+@])(\1\1)?(.*?@@|.*)/"&#27;[".($2&amp;&amp;"1;").((4*ord)%9+31)."m$&amp;&#27;[m"/e

Try it online!