[jboss-jira] [JBoss JIRA] (WFCORE-3818) Improved console color capability detection

David Lloyd (JIRA) issues at jboss.org
Thu May 10 09:28:00 EDT 2018


David Lloyd created WFCORE-3818:
-----------------------------------

             Summary: Improved console color capability detection
                 Key: WFCORE-3818
                 URL: https://issues.jboss.org/browse/WFCORE-3818
             Project: WildFly Core
          Issue Type: Enhancement
          Components: Logging, Scripts
            Reporter: David Lloyd


We should improve on our ability to correctly detect color capabilities on the console.  Many times, build logs in CI environments and similar cases are hard to read due to ANSI codes being written to a console that did not have color capabilities, and this could have been detected.

In the bash scripts, logic like the following can be used:

* If the {{tput}} command does not exist, fall back to checking {{TERM}}.
* If {{tput colors}} returns 8, 16, or 256, the terminal supports at least that many colors.
* The {{TERM}} var: the terminal supports 256 colors if {{TERM}] contains values xterm-256color, screen-256color, or generally any value containing 256 probably indicates color support.
* Check the value of the COLORTERM environment variable; if truecolor or 24bit, then you have 24-bit RGB capability (this should apply to Linux, Mac OS X, and Windows).

On Windows, COLORTERM is also usually supported in terminals supporting 24-bit RGB; presence of this env var may be sufficient to enable color.  The TERM environment variable is also often supported.




--
This message was sent by Atlassian JIRA
(v7.5.0#75005)


More information about the jboss-jira mailing list