@Override
	public Color getForegroundForToken( Token t ) {
		if( useColorOfColorTokens && t.getType() == FlatThemeTokenMaker.TOKEN_COLOR && !isCurrentLineHighlighted( t.getOffset() )) {
			Color color = parseColor( t );
			if( color != null ) {
				return (colorLuminance( color ) > 164 || color.getAlpha() < 96)
					? Color.black
					: Color.white;
			}
		}

		return super.getForegroundForToken( t );
	}
A text area that supports editing FlatLaf themes.

@author Karl Tauber
flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatSyntaxTextArea.java