Hello Varun, you can try using TCS3200 Color Sensor Module with Raspberry Pi. refer below article / blog.
https://circuitdigest.com/microcontroller-projects/raspberry-pi-color-detector
https://www.raspberrypi.org/blog/colour-sensing-raspberry-pi/ 
https://www.hackster.io/aula-jazmati/color-detection-using-raspberry-pi-python-animation-tools-445349 
https://gist.github.com/aula9/69473ef635e3f8610dcc36815116b4f4
https://drive.google.com/file/d/15ABWtYKKCOR3ZTmqzluHFvd4Qtql49Ut/view 
https://www.electronicshub.org/raspberry-pi-color-sensor-tutorial/
https://www.bluetin.io/opencv/opencv-color-detection-filtering-python/
https://www.oreilly.com/library/view/raspberry-pi-for/9781785288326/ch08s08.html