color.cpp refactoring: created generic interface for toRGB and fromRGB callers