<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    Hello, Andy<br>
    <br>
    Yes, I need to add a background color for a text segment within a
    paragraph using CSS. <br>
    <br>
    I have just opened an issue with ID : 9078469.<br>
    <br>
    Can anyone give an estimate of when this issue might be addressed?
    Background color is such a fundamental feature <br>
    that it's impossible to work without it.<br>
    <br>
    Best regards, Pavel<br>
    <br>
    <br>
    <div class="moz-cite-prefix">On 5/5/25 22:09, Andy Goryachev wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:BYAPR10MB301337BF68C158E7D687E9F8E58E2@BYAPR10MB3013.namprd10.prod.outlook.com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <meta name="Generator"
        content="Microsoft Word 15 (filtered medium)">
      <style>@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
        {font-family:Aptos;
        panose-1:2 11 0 4 2 2 2 2 2 4;}@font-face
        {font-family:"Iosevka Fixed SS16";
        panose-1:2 0 5 9 3 0 0 0 0 4;}@font-face
        {font-family:"Times New Roman \(Body CS\)";
        panose-1:2 11 6 4 2 2 2 2 2 4;}p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:10.0pt;
        font-family:"Aptos",sans-serif;}span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Iosevka Fixed SS16";
        color:windowtext;}.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;
        mso-ligatures:none;}div.WordSection1
        {page:WordSection1;}</style>
      <div class="WordSection1">
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">Dear
            Pavel:<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">Can
            you clarify what you are trying to do exactly?<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">If
            you are trying to add a background to a text segment within
            the paragraph (as your code seem to indicate), then the only
            way to do it is to call Builder.addHighlight().<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">If
            you are trying to set the background of the whole paragraph,
            you've hit another missing API similar to JDK-8355774 -
            there is currently no way to style the paragraphs via CSS. 
            There is the
            Builder.setParagraphAttributes(StyleAttributeMap) but a CSS
            one is missing.<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">-andy<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""><o:p> </o:p></span></p>
        <div id="mail-editor-reference-message-container">
          <div>
            <div>
              <div
style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
                <p class="MsoNormal" style="margin-bottom:12.0pt"><b><span
                      style="font-size:12.0pt;color:black">From:
                    </span></b><span
                    style="font-size:12.0pt;color:black">openjfx-dev
                    <a class="moz-txt-link-rfc2396E" href="mailto:openjfx-dev-retn@openjdk.org"><openjfx-dev-retn@openjdk.org></a> on behalf of
                    PavelTurk <a class="moz-txt-link-rfc2396E" href="mailto:pavelturk2000@gmail.com"><pavelturk2000@gmail.com></a><br>
                    <b>Date: </b>Saturday, May 3, 2025 at 10:07<br>
                    <b>To: </b><a class="moz-txt-link-abbreviated" href="mailto:openjfx-dev@openjdk.org">openjfx-dev@openjdk.org</a>
                    <a class="moz-txt-link-rfc2396E" href="mailto:openjfx-dev@openjdk.org"><openjfx-dev@openjdk.org></a><br>
                    <b>Subject: </b>CodeArea: -fx-background-color
                    doesn't work.<o:p></o:p></span></p>
              </div>
              <div>
                <p class="MsoNormal"><span style="font-size:11.0pt">For styling CodeArea, I use exclusively style classes, and this is the foundation of my entire architecture.<br>
Today I tried to implement search highlighting (via background color), but it didn't work. Below is my test code.<br>
                    <br>
Can anyone tell me how to set the background color using CSS? For example, in RichTextFX's CodeArea,<br>
                    they have -rtfx-background-color.<br>
                    <br>
                    public class JfxCodeArea extends Application {<br>
                    <br>
                         @Override<br>
     public void start(Stage primaryStage) throws Exception {<br>
                             String text = """<br>
                       Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt<br>
                       ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco<br>
                       laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit<br>
                       in voluptate velit esse cillum dolore eu fugiat nulla pariatur.<br>
                                           """;<br>
                    <br>
                             String css = """<br>
                                 .test {<br>
                                     -fx-font-weight: bold;<br>
                                     -fx-fill: red;<br>
                                     -fx-background-color: green;<br>
                                 }<br>
                    <br>
                             """;<br>
                             String data =
<a class="moz-txt-link-rfc2396E" href="data:text/css;base64,">"data:text/css;base64,"</a> + Base64.getEncoder().encodeToString(css.getBytes(StandardCharsets.UTF_8));<br>
                    <br>
                             CodeArea codeArea = new CodeArea();<br>
                             codeArea.getStylesheets().add(data);<br>
                    <br>
         codeArea.setSyntaxDecorator(new SyntaxDecorator() {<br>
                                 @Override<br>
             public RichParagraph createRichParagraph(CodeTextModel model, int index) {<br>
                 var builder = RichParagraph.builder();<br>
                 builder.addWithStyleNames(model.getPlainText(index), "test");<br>
                                     return builder.build();<br>
                                 }<br>
                    <br>
                                 @Override<br>
             public void handleChange(CodeTextModel m, TextPos start, TextPos end, int charsTop, int linesAdded, int charsBottom) {<br>
                    <br>
                                 }<br>
                             });<br>
                    <br>
                             VBox.setVgrow(codeArea, Priority.ALWAYS);<br>
                             var button = new Button("Go!");<br>
         button.setOnAction(e -> codeArea.setText(text));<br>
                             VBox root = new VBox(codeArea, button);<br>
                             Scene scene = new Scene(root, 600, 200);<br>
                             primaryStage.setScene(scene);<br>
                             primaryStage.show();<br>
                    <br>
                         }<br>
                    <br>
                         public static void main(String[] args) {<br>
                             launch(args);<br>
                         }<br>
                    }<br>
                    <br>
                    Best regards, Pavel<o:p></o:p></span></p>
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>