Finds the key of the closest matching color in an object to the given RGB color.
It goes through each key-value pair of the object, checks if the value is a string starting with "#", and if it is, it calculates the distance between the two colors. If the distance is smaller than the current smallest distance, it updates the smallest distance and the closest match.
Parameters
rgb: [number,number,number]
The RGB color to find the closest match for.
obj: {[key:string]:string}
The object to search in.
Returns string
The key of the closest matching color, or null if no color was found.
Finds the key of the closest matching color in an object to the given RGB color.
It goes through each key-value pair of the object, checks if the value is a string starting with "#", and if it is, it calculates the distance between the two colors. If the distance is smaller than the current smallest distance, it updates the smallest distance and the closest match.