Java 类com.intellij.openapi.actionSystem.impl.IdeaActionButtonLook 实例源码

项目:material-theme-jetbrains    文件:UIReplacer.java   
static void patchPanels() throws Exception {
  if (MTConfig.getInstance().isMaterialTheme()) {
    final Color color = UIManager.getColor("Panel.background");
    StaticPatcher.setFinalStatic(UIUtil.class, "CONTRAST_BORDER_COLOR", ColorUtil.withAlpha(color, .05));
    StaticPatcher.setFinalStatic(UIUtil.class, "BORDER_COLOR", color);
    StaticPatcher.setFinalStatic(UIUtil.class, "AQUA_SEPARATOR_FOREGROUND_COLOR", color);
    //        StaticPatcher.setFinalStatic(HelpTooltip.class, "BACKGROUND_COLOR", color);
  }

  final Field[] fields = DarculaUIUtil.class.getDeclaredFields();
  final Object[] objects = Arrays.stream(fields)
                                 .filter(f -> f.getType().equals(Color.class))
                                 .toArray();
  final Color accentColor = ColorUtil.fromHex(MTConfig.getInstance().getAccentColor());
  final JBColor accentJBColor = new JBColor(accentColor, accentColor);
  StaticPatcher.setFinalStatic((Field) objects[0], accentJBColor);
  //      StaticPatcher.setFinalStatic((Field) objects[1], accentJBColor);

  final Field[] fields2 = IdeaActionButtonLook.class.getDeclaredFields();
  final Object[] objects2 = Arrays.stream(fields2)
                                  .filter(f -> f.getType().equals(Color.class))
                                  .toArray();

  StaticPatcher.setFinalStatic((Field) objects2[1], accentJBColor);
}