private Map<String, String> removeThemeSpecificProps( Properties properties ) {
		// search for theme specific properties keys
		ArrayList<String> themeSpecificKeys = new ArrayList<>();
		for( Object key : properties.keySet() ) {
			if( ((String)key).startsWith( "{" ) )
				themeSpecificKeys.add( (String) key );
		}

		// special prefixes (priority from highest to lowest)
		String currentThemePrefix = '{' + name.replace( ' ', '_' ) + '}';
		String currentThemeAndAuthorPrefix = '{' + name.replace( ' ', '_' ) + "---" + author.replace( ' ', '_' ) + '}';
		String currentAuthorPrefix = "{author-" + author.replace( ' ', '_' ) + '}';
		String lightOrDarkPrefix = dark ? "{*-dark}" : "{*-light}";
		String allThemesPrefix = "{*}";
		String[] prefixes = { currentThemePrefix, currentThemeAndAuthorPrefix, currentAuthorPrefix, lightOrDarkPrefix, allThemesPrefix };

		// collect values for special prefixes in its own maps
		@SuppressWarnings( "unchecked" )
		Map<String, String>[] maps = new Map[prefixes.length];
		for( int i = 0; i < maps.length; i++ )
			maps[i] = new HashMap<>();

		// remove theme specific properties and remember only those for current theme
		for( String key : themeSpecificKeys ) {
			String value = (String) properties.remove( key );
			for( int i = 0; i < prefixes.length; i++ ) {
				String prefix = prefixes[i];
				if( key.startsWith( prefix ) ) {
					maps[i].put( key.substring( prefix.length() ), value );
					break;
				}
			}
		}

		// copy values into single map (from lowest to highest priority)
		Map<String, String> themeSpecificProps = new HashMap<>();
		for( int i = maps.length - 1; i >= 0; i-- )
			themeSpecificProps.putAll( maps[i] );
		return themeSpecificProps;
	}
Loads a IntelliJ .theme.json file from the given input stream.

The input stream is automatically closed.
Using a buffered input stream is not necessary.
flatlaf-core/src/main/java/com/formdev/flatlaf/IntelliJTheme.java