RichTextFX icon indicating copy to clipboard operation
RichTextFX copied to clipboard

Selected color with alpha add extra colors

Open PavelTurk opened this issue 8 months ago • 3 comments

This is my java code:

public class JavaFxTest8 extends Application {

   @Override
    public void start(Stage primaryStage) {
        var text = """
                   aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                   bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
                   cccccccccccccccccccccccccccccccccccccccccccc
                   dddddddddddddddddddddddddddddddddddddddddddd
                   eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
                   """;
        var codeArea = new CodeArea(text);
        VBox.setVgrow(codeArea, Priority.ALWAYS);
        Scene scene = new Scene(new VBox(codeArea), 500, 200);
        var css= this.getClass().getResource("test8.css").toExternalForm();
        scene.getStylesheets().add(css);
        primaryStage.setScene(scene);
        primaryStage.show();
        codeArea.selectRange(30, 200);
    }

    public static void main(String[] args) {
        launch(args);
    }
}

This is CSS code:

.root {
    -fx-font-size: 16;
}
.styled-text-area {
    -fx-background-color: #666666;
}

.styled-text-area .main-selection {
    -fx-fill: rgba(255, 0, 0, 0.4);
}

And this is result: Screenshot from 2024-06-03 14-36-36

As you see selected text is "underlined". Is this a bug or I do something wrong?

PavelTurk avatar Jun 03 '24 11:06 PavelTurk