4

Most traditional command line tools (such as those found on a *nix system) have very simple outputs and usually never print in color, unless requested to, even if they do have the capability to do so.

However, there are some "modern" command line tools (especially those used in the field of web development, for example 1,2,3,4) that usually have a lot of color in their outputs and highlight various fields in the presented information.

What are the guidelines for outputting color in a command-line application? Specifically, when should colors be used for the output of a command-line application?

2

Most modern command line tools allow the user to choose the colours. Typically colour is used to identify the discrete unique elements in your command line syntax, and it makes it easier to identify those unique elements.

2

The way color is used in the command line tools you are showing is to help the readability of what is written. This is specially useful when reading code as color helps visually understand:

  • the element is different from the others
  • what kind of element it is
  • where does it start and where does it end
  • extra hints such as a term belongs to an action: there is some error, the code is incomplete, etc.

As far as I know, what colors to use for each element depends on the designer. The goal is to keep the color meaningful and useful to help the user visually scan the content and give them feedback of what is going on.

When should colors be used in a command line application? When they help the readability of the content (and are not used as pure decoration).

0

As a system admin and developer I see the command line as an immediate script console. In other words a sort of programming language with immediate results. Not unlike the debug view of many IDEs. And syntax highlight helps a lot in those tasks. So, yes, colors can help.

0

As little as possible. So often I see pictures of editor output with so many colors I can't understand how one picks anything out of that. While typographers will implore you to not interrupt reading with any variation of text, users of editors and IDEs may have three or four different colors, sometimes hideous, in one short line of code.

Consider bold or gray first to highlight important information if it's really needed. Otherwise, don't. Use color as a last resort. Color will be a distraction that can be helpful but also a hindrance when reading anything. That this is a command line application, or code, makes no difference.

So ask yourself the questions. Why do I need to highlight this at all? Why does it need to be in color?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.