3

I'm using RichTextFx (CodeArea) to highlight my code. I want to change text background color for some keywords and use css below:

.parameter {
    -rtfx-background-color: yellow;
}

But it's changes background color for all text between my keywords (:p1 and :p2 in this example). Font color and style change successfully. enter image description here

Dave Jarvis
  • 30,436
  • 41
  • 178
  • 315
DaddyRatel
  • 729
  • 3
  • 13
  • 30
  • 2
    This is what i was searching for ` -rtfx-background-color: yellow;` Thank you so much! – GOXR3PLUS Nov 22 '17 at 06:29
  • 2
    You have to use something like `textArea.setStyle(from,to, "style");` where textArea is a RichTextFx (CodeArea) . For me it works like charm! – GOXR3PLUS Nov 22 '17 at 06:30

1 Answers1

1

use StyleClassedTextArea.setStyleClass(from, to, "class Name"); to add class name to some specific range.