/**
  * Creates a theme with custom colors.
  *
  * @param name the name of this theme
  * @param controlColor the background color for buttons, labels etc.
  * @param primaryControlColor the color of scrollbar "knobs", text and menu selection background
  * @param backgroundColor the background color for viewports, tree's, tables etc.
  * @param textColor the text color
  */
 public InfoNodeLookAndFeelTheme(
     String name,
     Color controlColor,
     Color primaryControlColor,
     Color backgroundColor,
     Color textColor) {
   this(
       name,
       controlColor,
       primaryControlColor,
       backgroundColor,
       textColor,
       primaryControlColor,
       ColorUtil.getOpposite(primaryControlColor));
 }
  private void updateColors() {
    focusColor.setDefaultColor(
        ColorUtil.blend(controlColor.getColor(), textColor.getColor(), 0.5f));

    inactiveTextColor.setDefaultColor(focusColor);

    double invShadeAmount = 1.0 / (1 + shadingFactor * 1.2);
    double invShadeAmount2 = 1.0 / (1 + shadingFactor / 2);
    double invShadeAmount3 = 1.0 / (1 + shadingFactor / 7);

    controlHighlightColor =
        new ColorUIResource(ColorUtil.mult(controlColor.getColor(), 1 + shadingFactor));
    controlLightShadowColor =
        new ColorUIResource(ColorUtil.mult(controlColor.getColor(), invShadeAmount3));
    controlShadowColor =
        new ColorUIResource(ColorUtil.mult(controlColor.getColor(), invShadeAmount2));
    controlDarkShadowColor =
        new ColorUIResource(ColorUtil.mult(controlColor.getColor(), invShadeAmount));

    primaryControlHighlightColor = controlHighlightColor;
    primaryControlShadowColor =
        new ColorUIResource(ColorUtil.mult(primaryControlColor.getColor(), invShadeAmount2));
    primaryControlDarkShadowColor =
        new ColorUIResource(ColorUtil.mult(primaryControlColor.getColor(), invShadeAmount));

    scrollBarBackgroundColor.setDefaultColor(controlLightShadowColor);
    scrollBarBackgroundShadowColor =
        new ColorUIResource(ColorUtil.mult(scrollBarBackgroundColor.getColor(), invShadeAmount));

    selectedMenuBackgroundColor.setDefaultColor(selectedTextBackgroundColor);
    selectedMenuForegroundColor.setDefaultColor(selectedTextColor);

    treeIconBackgroundColor.setDefaultColor(
        ColorUtil.blend(backgroundColor.getColor(), primaryControlColor.getColor(), 0.15f));

    activeInternalFrameTitleBackgroundColor.setDefaultColor(
        ColorUtil.blend(
            primaryControlColor.getColor(), ColorUtil.getOpposite(getTextColor()), 0.5f));
    activeInternalFrameTitleForegroundColor.setDefaultColor(getTextColor());
    activeInternalFrameTitleGradientColor.setDefaultColor(
        ColorUtil.mult(activeInternalFrameTitleBackgroundColor.getColor(), 1.2));
    inactiveInternalFrameTitleBackgroundColor.setDefaultColor(controlLightShadowColor);
    inactiveInternalFrameTitleForegroundColor.setDefaultColor(getTextColor());
    inactiveInternalFrameTitleGradientColor.setDefaultColor(
        ColorUtil.mult(inactiveInternalFrameTitleBackgroundColor.getColor(), 1.2));

    menuBarBorder.setDefaultBorder(
        new BorderUIResource(
            new EtchedLineBorder(
                false, false, true, false, controlHighlightColor, controlDarkShadowColor)));
    popupMenuBorder.setDefaultBorder(
        new BorderUIResource(new PopupMenuBorder(controlHighlightColor, controlDarkShadowColor)));
    textFieldBorder.setDefaultBorder(
        new BorderUIResource(
            new CompoundBorder(
                new LineBorder(controlDarkShadowColor), new EmptyBorder(1, 2, 1, 2))));

    tableHeaderCellBorder.setDefaultBorder(
        new BorderUIResource(
            new CompoundBorder(
                new CompoundBorder(
                    new EdgeBorder(controlDarkShadowColor, false, true, false, true),
                    new HighlightBorder(false, controlHighlightColor)),
                new EmptyBorder(1, 4, 1, 4))));

    listFocusedItemBorder.setDefaultBorder(
        new CompoundBorder(new LineBorder(focusColor.getColor()), new EmptyBorder(0, 3, 0, 3)));
  }