When sending a text file to the printer from the command line (by, e.g.,
lpr -P printer-name file.txt), is it possible to specify that inverted colors be used by the printer (i.e., white text on black background)?
lpr does not have an option for this. Your printer may accept an option that can be used for this purpose. To use that hypothetical option, you would use
lpoptions -lto list the available options, and
lpoptions -oto set a particular option.
These are CUPS commands, and likely are on your computer.
Different printers have different options.