public static Color getParentBackground( JComponent c ) {
		Container parent = findOpaqueParent( c );
		// parent.getBackground() may return null
		// (e.g. for Swing delegate components used for AWT components on macOS)
		Color background = (parent != null) ? parent.getBackground() : null;
		if( background != null )
			return background;

		if( isAWTPeer( c ) ) {
			// AWT peers usually use component background, except for TextField and ScrollPane
			return c instanceof JTextField || c instanceof JScrollPane || c.getBackground() == null
				? SystemColor.window
				: c.getBackground();
		}

		return UIManager.getColor( "Panel.background" );
	}
Gets the background color of the first opaque parent.
flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatUIUtils.java