Unroll inversion, introduce color values

This introduces color values where there were simple numbers up to now (in fact, those color values are numbers, too, but tagged with a certain ctype). Also fixes some minor issues that came up when unrolling the inversion mess.

Needs https://github.com/koreader/koreader-base/pull/246