private Color average(List<Color> colors) {
        //int r = 0;
        //int g = 0;
        //int b = 0;
        float h = 0;
        float s = 0;
        float b = 0;

        for (Color c : colors) {
            //r += c.getRed();
            //g += c.getGreen();
            //b += c.getBlue();
            float[] hsbColor = Color.RGBtoHSB(c.getRed(), c.getGreen(), c.getBlue(), null);
            h += hsbColor[0];
            s += hsbColor[1];
            b += hsbColor[2];
        }

        float l = (float) colors.size();
        h /= l;
        s /= l;
        b /= l; // average

        return new Color(Color.HSBtoRGB(h, s, b));
    }