RSyntaxTextArea icon indicating copy to clipboard operation
RSyntaxTextArea copied to clipboard

Apply a theme to a RTextArea

Open priand opened this issue 2 years ago • 0 comments

Describe the solution you'd like A theme org.fife.ui.rsyntaxtextarea.Theme can be assigned to a RSyntaxTextArea, but not to a RTextArea. We should be able to apply a subset of the Theme to RTextArea, so we keep all the components consistent from a LaF standpoint.

Are there any workarounds? Did that in my own code:

	private static void apply(Theme t, RTextArea textArea) {
		Color fg = UIManager.getColor("TextArea.foreground");
		textArea.setForeground(fg);
		textArea.setFont(t.baseFont);
		textArea.setBackground(t.bgColor);
		textArea.setCaretColor(t.caretColor);
		textArea.setSelectedTextColor(t.selectionFG);
		textArea.setSelectionColor(t.selectionBG);
		textArea.setRoundedSelectionEdges(t.selectionRoundedEdges);
		textArea.setCurrentLineHighlightColor(t.currentLineHighlight);
		textArea.setFadeCurrentLineHighlight(t.fadeCurrentLineHighlight);
		textArea.setMarginLineColor(t.marginLineColor);
		textArea.setMarkAllHighlightColor(t.markAllHighlightColor);
	}

It works with FlatLaf.

priand avatar Feb 13 '23 02:02 priand