Just encountered the same problem.
To override JavaFX default styles in RichTextFX, use !important
in your CSS. For example, -fx-background-color: #1E1E1E !important;
ensures the background color is applied even if other styles are set, ensuring that your custom background color takes precedence.