public static int getClosestColor(int red, int green, int blue) {
        if(red < 0 || red > 255)
            throw new IllegalArgumentException("getClosestColor: red is outside of valid range (0-255)");
        if(green < 0 || green > 255)
            throw new IllegalArgumentException("getClosestColor: green is outside of valid range (0-255)");
        if(blue < 0 || blue > 255)
            throw new IllegalArgumentException("getClosestColor: blue is outside of valid range (0-255)");
        
        double closestMatch = Double.MAX_VALUE;
        int closestIndex = 0;
        for(Entry entry : colorEntries) {
            double distance = entry.distanceTo(red, green, blue);
            if(distance < closestMatch) {
                closestIndex = entry.index;
                closestMatch = distance;
            }
        }
        return closestIndex;
    }