def read_color_name(self):
        """ Reads the measured color and maps it to the nearest color present in COLOR_TABLE.

        Warning: current implementation does not work well with white / grey / black or dark colors.

        :return: The color name used as a key in COLOR_TABLE.
        """
        xy = self.read_xy()
        closest_color = None
        closest_distance = 1
        for current_color in self.COLOR_TABLE:
            current_coordinates = self.COLOR_TABLE[current_color]
            current_dist = math.sqrt(
                    (current_coordinates["y"] - xy[1])**2 + (current_coordinates["x"] - xy[0])**2)
            if current_dist < closest_distance:
                closest_color = current_color
                closest_distance = current_dist

        return closest_color
dataset/ETHPy150Open DexterInd/GrovePi/Software/Python/grove_i2c_color_sensor/grove_i2c_color_sensor.py/GroveI2CColorSensor.read_color_name/original