Given data:

R   G   B   Color
0   0   0   Black
255 255 255 White
255 0   0   Red
0   255 0   Lime
0   0   255 Blue
255 255 0   Yellow
0   255 255 Cyan_Aqua

Can we predict the color given an RGB input? For example,

224, 255, 255=light_cyan

The goal is to generate logical names and not random names. For instance, if the data contains "green", a closest match with lighter hue, would be named "light green".

If yes, some pointers would be very helpful.

  • $\begingroup$ Do you have data for all possible colour names, so you can in theory classify a new RGB to an existing name in your data set? Or are you asking about predicting names that are not in your data set? Generating new colour names might be possible, but is a far harder task than classifying to existing colours . . . however, I am asking because your example prediction shows a name that does not appear in your sample data. $\endgroup$ Sep 21, 2018 at 11:53
  • $\begingroup$ If I have list of all possible colours, then i can just create if-else conditions. Then i guess this is not ML problem? I am looking at predicting a colour which is not in the list $\endgroup$
    – gammay
    Sep 21, 2018 at 12:00
  • $\begingroup$ That is not what I am trying to clarify: It is OK, and perhaps a simple ML problem for the specific RGB combination to not be on the list, and attempt to find the best name from a list of names. However, it is not simple for both the RGB combination and the target name to not be on your list. That would involved generating names. If your original list did not contain the word "orange", but did contain RGB value examples for "red", "yellow" and "brown", would you expect the ML to output the string "orange" when given rgb(255,165,0)? $\endgroup$ Sep 21, 2018 at 12:15
  • $\begingroup$ Of course, we cannot expect it to output "orange" when it has not seen the name before. But, say, if my RGB list has all types of greens and then it finds an RGB which closely matches one of them, then can it output the closest hue? $\endgroup$
    – gammay
    Sep 21, 2018 at 12:40
  • $\begingroup$ Yes, that is what I am asking. Is that your goal here, to generate names based on a likely RGB match to existing names? If so, please edit the question to make it clear, because it looks like on a first read that you are expecting to generate new names, perhaps in combination - e.g. figure out that it should call a colour "Light Cyan" because it has seen "Cyan Aqua" and somehow understands how the parts of the name relate to RGB space. $\endgroup$ Sep 21, 2018 at 12:44

1 Answer 1


I wrote a command-line tool that does exactly that: Cict


$ ./cict 000081
1   #000080 navyblue

As you can see, you simple pass a 24-bit hex-value to cict and it reports the distance to the color found (1 in this case), the value of the actual color (#000080) and the name (navyblue).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.