Write a file called
bw.cfg and containing
and modify your main file to have
before the call to
xcolor. For printing in colors just rename the file.
Full test document.
Here's the output when
latexmk -g -pdf testcolor is run and the configuration file is found.
bw.cfg-disabled the output is
-g option to force full compilation. You need it only when changing the color option, of course.
You can use the
-jobname option to make
latexmk produce a differently named PDF file. A shell script doing the two runs of
latexmk (with renaming of the
.cfg file) is the easiest way to get two PDF files.