Here you can find the source of getGripperForegroundColor(Color color)
static Color getGripperForegroundColor(Color color)
//package com.java2s; import javax.swing.plaf.ColorUIResource; import java.awt.*; public class Main { static Color getGripperForegroundColor(Color color) { int r = getGripperValue(color.getRed()); int g = getGripperValue(color.getGreen()); int b = getGripperValue(color.getBlue()); if (r >= 255) r = 255;/* ww w. j a v a 2 s .c o m*/ if (g >= 255) g = 255; if (b >= 255) b = 255; return new ColorUIResource(r, g, b); } static int getGripperValue(int x) { if (x == 255) { return 0; } else if (x >= 0 && x <= 64) { return x * 33 / 64 + 123; } else { return (x - 65) * 157 / 189 + 33; } } }