src/test/java/Screen.java
public static Color takeColor(double percentageWidth, double percentageHeight, int radius) {
        Point adjustedPos = getPointByPercentages(percentageWidth, percentageHeight);

        // Move the cursor out of the way
        Bot.r.mouseMove(0, 0);

        Bot.r.mouseMove(adjustedPos.x, adjustedPos.y);
        Bot.r.delay(500);

        System.out.println("Taking color from: " + adjustedPos.x + " " + adjustedPos.y);
        ArrayList<Color> pickedColors = new ArrayList<>();
        for (int xOffset = -(radius / 2); xOffset < radius / 2; xOffset++) {
            for (int yOffset = -(radius / 2); yOffset < radius / 2; yOffset++) {
                int x = adjustedPos.x + xOffset;
                int y = adjustedPos.y + yOffset;
                Color color = Bot.r.getPixelColor(x, y);
                pickedColors.add(color);
                // System.out.printf("%d, %d: %s,%s,%s\n", x, y, color.getRed(), color.getGreen(), color.getBlue());
            }
        }

        int totalRed    = 0;
        int totalGreen  = 0;
        int totalBlue   = 0;

        for (Color color : pickedColors) {
            totalRed    += color.getRed();
            totalGreen  += color.getGreen();
            totalBlue   += color.getBlue();
        }

        Bot.r.mouseMove(screenCenter.x, screenCenter.y);
        Color averageColor = new Color(totalRed / pickedColors.size(), totalGreen / pickedColors.size(), totalBlue / pickedColors.size());
        // System.out.printf("Average color: %s,%s,%s\n", averageColor.getRed(), averageColor.getGreen(), averageColor.getBlue());

        return averageColor;
    }
/**
     * @param percentageWidth range: 0..100
     * @param percentageHeight range: 0..100
     * @param radius Is used for the size of the square of pixels of which the average color is taken.
     * @return
     */
@param percentageWidth range: 0..100
@param percentageHeight range: 0..100
@param radius Is used for the size of the square of pixels of which the average color is taken.
@return
@param percentageWidth range : 0 .. 100 @param percentageHeight range : 0 .. 100 @param radius Is used for the size of the square of pixels of which the average color is taken . @return
public static Color takeColor(double percentageWidth, double percentageHeight, int radius) {
        Point adjustedPos = getPointByPercentages(percentageWidth, percentageHeight);
        Bot.r.mouseMove(0, 0);
        Bot.r.mouseMove(adjustedPos.x, adjustedPos.y);
        Bot.r.delay(500);
        System.out.println("Taking color from: " + adjustedPos.x + " " + adjustedPos.y);
        ArrayList<Color> pickedColors = new ArrayList<>();
        for (int xOffset = -(radius / 2); xOffset < radius / 2; xOffset++) {
            for (int yOffset = -(radius / 2); yOffset < radius / 2; yOffset++) {
                int x = adjustedPos.x + xOffset;
                int y = adjustedPos.y + yOffset;
                Color color = Bot.r.getPixelColor(x, y);
                pickedColors.add(color);
            }
        }
        int totalRed    = 0;
        int totalGreen  = 0;
        int totalBlue   = 0;
        for (Color color : pickedColors) {
            totalRed    += color.getRed();
            totalGreen  += color.getGreen();
            totalBlue   += color.getBlue();
        }
        Bot.r.mouseMove(screenCenter.x, screenCenter.y);
        Color averageColor = new Color(totalRed / pickedColors.size(), totalGreen / pickedColors.size(), totalBlue / pickedColors.size());
        return averageColor;
    }
public static Color takeColor ( double percentageWidth , double percentageHeight , int radius ) { Point adjustedPos = getPointByPercentages ( percentageWidth , percentageHeight ) ; Bot . r . mouseMove ( 0 , 0 ) ; Bot . r . mouseMove ( adjustedPos . x , adjustedPos . y ) ; Bot . r . delay ( 500 ) ; System . out . println ( "Taking color from: " + adjustedPos . x + " " + adjustedPos . y ) ; ArrayList < Color > pickedColors = new ArrayList < > ( ) ; for ( int xOffset = - ( radius / 2 ) ; xOffset < radius / 2 ; xOffset ++ ) { for ( int yOffset = - ( radius / 2 ) ; yOffset < radius / 2 ; yOffset ++ ) { int x = adjustedPos . x + xOffset ; int y = adjustedPos . y + yOffset ; Color color = Bot . r . getPixelColor ( x , y ) ; pickedColors . add ( color ) ; } } int totalRed = 0 ; int totalGreen = 0 ; int totalBlue = 0 ; for ( Color color : pickedColors ) { totalRed += color . getRed ( ) ; totalGreen += color . getGreen ( ) ; totalBlue += color . getBlue ( ) ; } Bot . r . mouseMove ( screenCenter . x , screenCenter . y ) ; Color averageColor = new Color ( totalRed / pickedColors . size ( ) , totalGreen / pickedColors . size ( ) , totalBlue / pickedColors . size ( ) ) ; return averageColor ; }
@param percentageWidth range: 0..100
 @param percentageHeight range: 0..100
 @param radius Is used for the size of the square of pixels of which the average color is taken.
@param percentageWidth range : 0 .. 100 @param percentageHeight range : 0 .. 100 @param radius Is used for the size of the square of pixels of which the average color is taken .
// Move the cursor out of the way // System.out.printf("%d, %d: %s,%s,%s\n", x, y, color.getRed(), color.getGreen(), color.getBlue()); // System.out.printf("Average color: %s,%s,%s\n", averageColor.getRed(), averageColor.getGreen(), averageColor.getBlue());