I am trying to implement a program that will classify the color scheme of the image based on the dominant colors. Example:

enter image description here

enter image description here

I am using machine learning tools but I wonder whether there is a mathematical approach to this problem. E.g. if the angle between the hues of two colors is between alpha and beta than it is a complementary scheme. I could not find any information on this topic. Any help would be very much appreciated.

  • 2
    Color theory could be called a science but in the context of design, there's a whole lot of subjectivity as well. To do this right, you'd really need some advance AI to make the subjectivity calls. FYI, your last example is not monochromatic in the context of print (ink) as you would need two colors to achieve that particular image.
    – DA01
    Dec 28, 2016 at 18:11
  • 1
    color theory and color science are different things. If you want to do color science you have to manipulate color in a scientifically meaningful colorspace such as CIE Lab or CIE XYZ. The reason people rarely bother with color science is that color science is actually a very, very hard subject. Once you understand that and human sensing you realize that the human intuition way is actually less work than modeling the thing mathematically with suficient accuracy for 90% of the realworld cases.
    – joojaa
    Dec 28, 2016 at 18:45

2 Answers 2


You can refer to the paper "Modeling How People Extract Color Themes from Images". It studies how to extract color themes from images automatically by mediating human's way to do it. The implementation can be found in https://github.com/sharondl/color-themes.


This is like coding basis right? A mathematical if clause like that in a program. I have focused on graphic design but have little background on software coding so I just give my combined know how for this. Forgive me if i might mislead you but I just give you some base point to start from. Just try it if it can help you.

Since you are getting the colors in flat files or jpegs. It is better to get the figures from hexadecimical colors. If a sampled color is less than or equal; it should give the value of a specific hexadecimal value of a color. The shades will follow. then narrow it down by selecting the colors you want to retain. Try to see the function of the Vector Magic program to see what I ment.

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.