class ColorProvider {

    public Color getMaskColor(String maskName) {
        Color color = getPredefinedColor(maskName);
        while (color == null) {
            int redStep = 0;
            int greenStep = 0;
            int blueStep = 0;
            double stepSize = 255.0;
            while (redStep % 2 == 0 && greenStep % 2 == 0 && blueStep % 2 == 0) {
                updateDivision();
                stepSize = 255.0 / (numberOfIntermediateSamplePoints + 1);
                redStep = (colourCounter / (numberOfTotalSamplePoints * numberOfTotalSamplePoints))
                        % numberOfTotalSamplePoints;
                greenStep = (colourCounter / numberOfTotalSamplePoints) % numberOfTotalSamplePoints;
                blueStep = colourCounter % numberOfTotalSamplePoints;
                colourCounter++;
            }
            final Color candidateColor =
                    new Color((int) (redStep * stepSize), (int) (greenStep * stepSize), (int) (blueStep * stepSize));
            if (!isPredefinedColor(candidateColor)) {
                color = candidateColor;
            }
        }
        return color;
    }

    public  ColorProvider();

}