Hi everyone, I have a question about working with styles when the user can 
change the theme (for example, from light to dark, or even within different 
dark variants).

Here’s the situation: I’m building a simple console where the user enters 
commands, the commands are executed, and output is displayed with styling. With 
RichTextFX, it was simple — I just added a piece of text and assigned a CSS 
class. When the user changed the theme, all the styles updated automatically.

Now I’m trying to do something similar with JFX RichTextArea, but unfortunately 
I haven’t figured out how yet. The only API I found for working with CSS styles 
is RichParagraph.builder(). But as far as I understand, it’s supposed to be 
used only with SyntaxDecorator. That’s fine in theory, but in that case I would 
have to store the model of my command output, which would significantly 
complicate things.

On the other hand, there is SimpleViewOnlyStyledModel, but as I understand it, 
that’s for read-only text, which doesn’t suit my needs.

Could someone suggest which API I should use for my case?

Best regards, Pavel

Reply via email to