Icon (@Nullable DefaultMutableTreeNode node, boolean selected) { if (myControl == null) myControl = new MyControl(); if (node == null || 0 == node.getChildCount()) return myControl.empty; if (selected && !ColorUtil.isDark(JBUI.CurrentTheme.Tree.BACKGROUND) && !ColorUtil.isDark(RenderingUtil.getSelectionBackground(myTree))) { selected = false; // do not use selected icon on light theme } return myTree.isExpanded(new TreePath(node.getPath())) ? myControl.expanded.apply(selected) : myControl.collapsed.apply(selected); }