1

I would like to display the output of a log entry with coded colors in a Javafx application.

The log lines I catch via ssh looking like "\u001B[32m" + text with logging information + "\u001B[0m"

I tested with TextFlow and WebView, neither of them could understand the color coding.

Can anyone give me a to display colored lines in a JavaFX container like TextFlow?

Thanks GGK

  • You need to convert ansi color to rgb – Giovanni Contreras Mar 31 '23 at 12:33
  • 1
    JavaFX does not support [ANSI escape sequences](https://stackoverflow.com/questions/4842424/list-of-ansi-color-escape-sequences) out of the box, nor is there likely to be an existing 3rd party library extension which provides the functionality. You would need to implement such functionality (or more likely a subset of it) if you want to gain such support. – jewelsea Mar 31 '23 at 17:11
  • 1
    Perhaps this could be done via using `TextFlow` or [`RichTextFX`](https://github.com/FXMisc/RichTextFX#features) and adding (perhaps a lot) of additional functionality which you code, or you could do something like [ansi-to-html](https://www.npmjs.com/package/ansi-to-html) and display the result in a WebView. – jewelsea Mar 31 '23 at 17:15
  • If you actually want to provide a JavaFX terminal to ssh, then look at [TerminalFX](https://github.com/javaterminal/TerminalFX). – jewelsea Mar 31 '23 at 17:19

0 Answers0