List of utility methods to do Color Darker
int | darker(int channel, int intensity) darker int color = channel - intensity; if (color < 0) { color = 0; return color; |
Color | darkerColor(Color c) darker Color return factorColor(c, sFactor);
|
Color | darkerColor(Color c, double amount) darker Color float[] hsbvals = new float[3]; Color.RGBtoHSB(c.getRed(), c.getGreen(), c.getBlue(), hsbvals); hsbvals[2] = Math.min(1f, Math.max(0f, (float) (hsbvals[2] - amount))); int rgb = Color.HSBtoRGB(hsbvals[0], hsbvals[1], hsbvals[2]); rgb |= c.getAlpha() << 24; return new Color(rgb, true); |
Color | darkerColor(Color color, double factor) Creates a new Color that is a darker version of this Color .
return new Color(Math.max((int) (color.getRed() * factor), 0), Math.max((int) (color.getGreen() * factor), 0), Math.max((int) (color.getBlue() * factor), 0)); |
String | darkerColor(String hexValue) darker Color return darkerColor(hexValue, 0.1);
|
Color | deriveColor(Color orig, int darker) Derives a color from another color by linearly shifting its blue, green, and blue values. int red = orig.getRed() - darker; int green = orig.getGreen() - darker; int blue = orig.getBlue() - darker; if (red < 0) red = 0; else if (red > 255) red = 255; if (green < 0) ... |
void | draw3DFrame(Graphics g, Rectangle rect, Color colorBackground, Color colorDark, Color colorLight) Draws a 3d frame around the designated rectangle. Color colorOld = g.getColor(); g.setColor(colorBackground); g.fillRect(rect.x, rect.y, rect.width, rect.height); g.setColor(colorDark); g.drawLine(rect.x, rect.y, rect.x, rect.y + (rect.height - 1)); g.drawLine(rect.x, rect.y, rect.x + (rect.width - 1), rect.y); g.setColor(colorLight); g.drawLine(rect.x + 1, rect.y + (rect.height - 1), rect.x + (rect.width - 1), rect.y + (rect.height - 1)); ... |
Color | getDarkColor() get Dark Color return new Color(20, 20, 20); |
Color[] | getDarkColors(Color[] colors, double fraction) get Dark Colors Color[] darkColors = new Color[colors.length]; int i = 0; for (Color color : colors) { darkColors[i] = darker(color, fraction); ++i; return darkColors; |
Color | getDarker(Color c) get Darker if (DARKER_CACHE == null) DARKER_CACHE = new HashMap(); int rgb = c.getRGB(); Color d = DARKER_CACHE.get(rgb); if (d == null) { if (c.equals(Color.WHITE)) { d = new Color(244, 244, 244); } else { ... |