Uploaded image for project: 'Maven Shared Components'
  1. Maven Shared Components
  2. MSHARED-687

Programmatic read-only access to Color API

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: maven-shared-utils-3.2.1
    • Fix Version/s: None
    • Component/s: maven-shared-utils
    • Labels:
      None

      Description

      We should provide a way to access programmatically the Color API, without being JAnsi specific. Read-only should suffice for now, as the styles can be changed through system properties. This would allow tools, like the Help Plugin, to interact with it without depending on the implementation.

      • Refactor JAnsi specific code currently in Style into AnsiMessageBuilder.
      • Make Style part of public API, and add getters boolean isBold(), boolean isBright(), String getColor(), boolean isBgBright() and String getBgColor().
      • Document Style.toString() to return a comma-separated list of the style components (e.g. bold,red).
      • Add a public List<String> getAvailableColorNames() method to MessageUtils. Today, it would return the list of color names in the enum Ansi.Color if JAnsi is present, otherwise an empty list.

      With those changes, a consumer could for example do:

      MessageUtils.buffer().success( Style.SUCCESS.toString() )
      

      in order to print the String representation of success with its own style, while not depending on JAnsi.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                gboue Guillaume Boué
                Reporter:
                gboue Guillaume Boué
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated: