COLORDIFF(1)

✨ COLORDIFF ✨

okay bestie, you know colordiff? that's the manual name btw, and it lives in the User Commands zone. let's get into it πŸ’…


πŸŽ€ NAME πŸŽ€

colordiff β€” a tool to colorize diff output 🌈


🌸 SYNOPSIS 🌸

colordiff [diff options] [colordiff options] {file1} {file2}

πŸ’– DESCRIPTION πŸ’–

so here's the tea πŸ“: colordiff is a wrapper for diff, and it produces the same output as diff β€” but with coloured syntax highlighting at the command line, because we deserve readability, no cap. the output is giving the same vibe as a diff-generated patch would look in Vim or Emacs with the appropriate syntax highlighting options turned on. ✨

the colour schemes can be read from a central configuration file, or from a local user ~/.colordiffrc file. πŸ‘‘

colordiff makes use of ANSI colours, so it'll only work when ANSI colours can actually be used β€” typical examples are xterms and Eterms, plus console sessions. πŸ’€

it's been tested on various flavours of Linux and under OpenBSD, but should be broadly portable to other systems. portable queen fr fr 🧚


πŸ¦‹ USAGE πŸ¦‹

use colordiff wherever you'd normally use diff, or instead pipe output to colordiff. lowkey iconic.

for example:

$ colordiff file1 file2
$ diff -u file1 file2 | colordiff

you can pipe the output to less, using the -R option (some systems or terminal types may get better results using -r instead β€” iykyk), which keeps the colour escape sequences, otherwise they get displayed incorrectly or discarded by less:

$ diff -u file1 file2 | colordiff | less -R

if you want to force disable colour escape sequences (for example to pipe the output to patch), you can use the option --color=no to do so:

$ diff -u file1 file2 | colordiff --color=no | patch -p0 -d another-working-dir

if you have wdiff installed, colordiff will correctly colourise the added and removed text, provided that the -n option is given to wdiff:

$ wdiff -n file1 file2 | colordiff

you may find it useful to make diff automatically call colordiff. add the following line to ~/.bashrc (or equivalent):

alias diff=colordiff

any options passed to colordiff are passed through to diff except for the colordiff-specific option difftype, e.g.

colordiff --difftype=debdiff file1 file2

valid values for difftype are: diff, diffc, diffu, diffy, wdiff, debdiff β€” these correspond to plain diffs, context diffs, unified diffs, side-by-side diffs, wdiff output and debdiff output respectively. 🫢 use these overrides when colordiff isn't able to determine the diff-type automatically.

alternatively, a construct such as cvs diff SOMETHING | colordiff can be included in ~/.bashrc as follows:

function cvsdiff () { cvs diff $@ | colordiff; }

or, combining the idea above using less:

function cvsdiff () { cvs diff $@ | colordiff |less -R; }

note that the function name, cvsdiff, can be customized. ✨

by default colordiff returns the exit code of the underlying diff invocation (if there is one), but there are some circumstances where it's useful to force colordiff's exit code to be zero β€” to do this use the option --fakeexitcode:

colordiff --fakeexitcode ...

πŸ’… OPTIONS πŸ’…

colordiff will send most options straight through to diff, but there are various colordiff-specific options you can use:

  • --help β€” show these colordiff-specific options πŸ‘€
  • --color=(yes|no) β€” force (or suppress) display of colours in output 🌈
  • --color=patches=(yes|no) β€” force (or suppress) inclusion of colour codes in patch output 🎨
  • --color-term-output-only β€” force colour to only appear in terminal output πŸ–₯️
  • --difftype=DIFFTYPE β€” force difftype detection to a specified format. DIFFTYPE can be: diff, diffc, diffu, diffy, debdiff, wdiff
  • --(no)banner β€” show (or suppress) the colordiff banner πŸŽ€

πŸ“ FILES πŸ“

  • /etc/colordiffrc β€” central configuration file. user-specific settings can be enabled by copying this file to ~/.colordiffrc and making the appropriate changes.
  • colordiffrc-lightbg β€” alternate configuration template for use with terminals having light backgrounds. copy this to /etc/colordiffrc or ~/.colordiffrc and customize. β˜€οΈ
  • colordiffrc-gitdiff β€” alternate configuration template for use with terminals having dark backgrounds, with colour defaults set to match the output of git diff. copy this to /etc/colordiffrc or ~/.colordiffrc and customize. πŸŒ™

😭 BUGS 😭

bug reports and suggestions/patches to <davee@sungate.co.uk> please. 🫢


πŸ‘‘ AUTHORS πŸ‘‘

  • Dave Ewart β€” colordiff author and Debian packager
  • Graham Wilson β€” manual page and XML source author
  • Colin Tuckley β€” Debian package sponsor

and that's the whole page bestie, no notes πŸ’– this was colordiff from the colordiff source, dated 01/12/2026 β€” go forth and diff in colour, you absolute main character 🌈✨