private static void dumpColorsToProperties( File dir, LookAndFeel lookAndFeel, UIDefaults defaults ) {
		// dump to string
		StringWriter stringWriter = new StringWriter( 100000 );
		new UIDefaultsDump( lookAndFeel, defaults ).dumpColorsAsProperties( new PrintWriter( stringWriter ) );

		String name = lookAndFeel instanceof MyBasicLookAndFeel
			? BasicLookAndFeel.class.getSimpleName()
			: lookAndFeel.getClass().getSimpleName();
		File file = new File( dir, name + ".properties" );

		// build and append differences
		if( file.exists() ) {
			try {
				Map<String, String> defaults1 = parse( new InputStreamReader(
					new FileInputStream( file ), StandardCharsets.UTF_8 ), true );
				Map<String, String> defaults2 = parse( new StringReader( stringWriter.toString() ), true );

				String diff = diff( defaults1, defaults2 );
				if( !diff.isEmpty() ) {
					stringWriter.write( "\n\n\n\n#==== Differences ==============================================================\n\n" );
					stringWriter.write( diff );
				}
			} catch( Exception ex ) {
				ex.printStackTrace();
				return;
			}
		}

		// write to file
		file.getParentFile().mkdirs();
		try( Writer fileWriter = new OutputStreamWriter(
			new FileOutputStream( file ), StandardCharsets.UTF_8 ) )
		{
			fileWriter.write( stringWriter.toString().replace( "\r", "" ) );
		} catch( IOException ex ) {
			ex.printStackTrace();
		}
	}
Dumps look and feel UI defaults to files.

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