JPanel (@NotNull JComponent label) { Color commentFg = JBColor.lazy(() -> { EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme(); TextAttributes commentAttributes = scheme.getAttributes(DefaultLanguageHighlighterColors.LINE_COMMENT); Color commentAttributesForegroundColor = commentAttributes.getForegroundColor(); if (commentAttributesForegroundColor != null && commentAttributes.getBackgroundColor() == null) { return commentAttributesForegroundColor; } return scheme.getDefaultForeground(); }); label.setForeground(commentFg); JPanel panel = new JPanel(new SingleComponentCenteringLayout()); panel.setBorder(JBUI.Borders.empty(5)); panel.setBackground(JBColor.lazy(() -> EditorColorsManager.getInstance().getGlobalScheme().getDefaultBackground())); panel.add(label); return panel; }