Color (@NotNull JList<Object> list, @Nullable Object value, int row, boolean selected) { // to be consistent with com.intellij.ui.tree.ui.DefaultTreeUI#getBackground if (selected) { return RenderingUtil.getSelectionBackground(list); } if (row == ListHoverListener.getHoveredIndex(list)) { Color background = RenderingUtil.getHoverBackground(list); if (background != null) return background; } if (value instanceof ColoredItem) { Color background = ((ColoredItem)value).getColor(); if (background != null) return background; } if (value instanceof BackgroundSupplier) { BackgroundSupplier supplier = (BackgroundSupplier)value; Color background = supplier.getElementBackground(row); if (background != null) return background; } if (list instanceof ListCellBackgroundSupplier) { ListCellBackgroundSupplier<Object> supplier = (ListCellBackgroundSupplier<Object>)list; Color background = supplier.getCellBackground(value, row); if (background != null) return background; } return null; }