RGB is done atlast. the code turned out to be cruelly small and simple
compared to all the confusion I got myself into.