Make predefined color values converted first to hexa for conversion precision

Signed-off-by: Jean-Marc.Levecque <jmarc.levecque@bbox.fr>
Make value calculation using maximum color value as divider

Signed-off-by: Jean-Marc.Levecque <jmarc.levecque@bbox.fr>