Java Color Value getDefaultBackgroundColor(Color color)

Here you can find the source of getDefaultBackgroundColor(Color color)

Description

get Default Background Color

License

Open Source License

Declaration

static Color getDefaultBackgroundColor(Color color) 

Method Source Code

//package com.java2s;
import javax.swing.plaf.ColorUIResource;
import java.awt.*;

public class Main {
    static Color getDefaultBackgroundColor(Color color) {
        Color backIDE;//from  w  ww  .  jav  a2s. c  o  m

        // Check for the 'Classic' control color
        if ((color.getRed() == 212) && (color.getGreen() == 208)
                && (color.getBlue() == 200)) {
            // Use the exact background for this color
            backIDE = new ColorUIResource(247, 243, 233);
        } else if ((color.getRed() == 236) && (color.getGreen() == 233)
                && (color.getBlue() == 216)) {
            // Check for the 'XP' control color
            // Use the exact background for this color
            backIDE = new ColorUIResource(255, 251, 233);
        } else {
            // Calculate the IDE background color as only half as dark as the control color
            int r = color.getRed() + 35;
            int g = color.getGreen() + 35;
            int b = color.getBlue() + 35;
            if (r >= 255)
                r = 255;
            if (g >= 255)
                g = 255;
            if (b >= 255)
                b = 255;
            backIDE = new ColorUIResource(r, g, b);
        }

        return backIDE;
    }
}

Related

  1. getColorForeground()
  2. getColorLabels(Object obj)
  3. getColorTercio(Color a, Color b)
  4. getColorValue(Element element, Object constant)
  5. getDefaultBackgroundColor()
  6. getDerivedColor(Color color, float ratio)
  7. getDisabledForeground(Color c)
  8. getDisabledLineColor()
  9. getFieldForegroundColor()