Background:

We are using [Vision API](https://cloud.google.com/vision) to detect color properties from an image. The color values are stored as RGB values in the database. We want the user's to search for colors in our web application.

Scenario:

I want users to be able to search for colors or choose colors from the dropdown. The results would be shown on the page. But as far as I know, we can make a search feature by using text or numbers.

Database:

I am using firebase firestore and firebase-admin on the server-side. I am getting responses for colors as RGB values. I am storing RBG values for colors in the database.

The question is how can we make a search using RGB values or hex's values?

**Update 1:**

Example:   

1: The user uploads an image, colors extracted and stored in firestore.   

2: So, If the user wants to search he will type red, green, blue, etc. There are only limited color names [link](https://www.w3schools.com/colors/colors_names.asp). (around 140)   

3: User can search for only 140 color names (I guess). but there would be millions of combinations of colors   

4: One thing is sure, the exact color could not be returned in every case.   

5: So, how could the nearest colors be returned.