private void dumpContrastRatio( PrintWriter out, String fgKey, String bgKey, AtomicReference<String> lastSubkey ) {
		Color background = defaults.getColor( bgKey );
		Color foreground = defaults.getColor( fgKey );
		if( background == null || foreground == null )
			return;

		String subkey = fgKey.substring( fgKey.lastIndexOf( '.' ) + 1 );
		if( lastSubkey != null && !subkey.equals( lastSubkey.get() ) ) {
			lastSubkey.set( subkey );
			out.println();
			out.println( "#-- " + subkey + " --" );
		}

		Color translucentForeground = null;
		if( foreground.getAlpha() != 255 ) {
			translucentForeground = foreground;
			float weight = foreground.getAlpha() / 255f;
			foreground = ColorFunctions.mix( new Color( foreground.getRGB() ), background, weight );
		}

		float luma1 = ColorFunctions.luma( background );
		float luma2 = ColorFunctions.luma( foreground );
		float contrastRatio = (luma1 > luma2)
			? (luma1 + 0.05f) / (luma2 + 0.05f)
			: (luma2 + 0.05f) / (luma1 + 0.05f);
		String rateing =
			contrastRatio < 1.95f ? "  !!!!!!" :
			contrastRatio < 2.95f ? "  !!!!!" :
			contrastRatio < 3.95f ? "  !!!!" :
			contrastRatio < 4.95f ? "  !!!" :
			contrastRatio < 5.95f ? "  !!" :
			contrastRatio < 6.95f ? "  !" :
			"";

		out.printf( "%-50s  #%06x  #%06x    %4.1f%s%s%n", fgKey,
			foreground.getRGB() & 0xffffff, background.getRGB() & 0xffffff,
			contrastRatio, rateing,
			translucentForeground != null ? "    " + dumpColorHex( translucentForeground ) : "" );
	}
Dumps look and feel UI defaults to files.

@author Karl Tauber
flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/uidefaults/UIDefaultsDump.java