In this project I had taken an image and tried to extract the dominating colors. Also I replicated the same image with the hence extracted colors. The algorithm I used for extraction is k-Means. It uses DBSAC rather than the random initialization for better performance. You need to provide the input path to your image.
You are needed to have scikit-learn library pre-installed. If not you can install it with command:
pip install sklearn