Add support for consistent color labels for sparse labels.

See issue #765.