cmdr::color - Cmdr - Terminal colors
Welcome to the Cmdr project, written by Andreas Kupries.
For availability please read Cmdr - How To Get The Sources.
This package provides a few utility commands implementing the management of terminal colors.
When invoked this command enables or disables color handling, as per the boolean flag enable. If enable is not specified the action defaults to activation.
The result of the command is the new activation state.
The default activation state of the package after loading depends on stdout. The package is active if stdout is a terminal, and inactive otherwise.
If set, enable color handling, else disable it.
The result of this command is the current activation state of the package.
The default activation state of the package after loading depends on stdout. The package is active if stdout is a terminal, and inactive otherwise.
When invoked this command returns a list of the symbolic color names known to the package.
When invoked this command returns the character sequence associated with the symbolic color name. An error is thrown if name is not a known symbol.
When invoked this command returns the specification associated with the symbolic color name. An error is thrown if name is not a known symbol.
When invoked this command defines the color name. If name exists already its previous specification is overwritten. The command accepts four forms of specifications, namely:
The rname must be the name of a known color. The name itself is not allowed, i.e. self-references are forbidden.
The R, G, and B values are integers in the range 0...5 directly specifying the chosen color. These specifications may not work if the terminal is not configured to support 256 colors.
The value is a comma-separated list of ANSI color control characters.
Any other string is acceptable too, and used as is.
When invoked this command tests if the symbolic color name is known, returns the boolean value true if so, and false else.
When invoked this command deletes the symbolic color name. An error is thrown if name is not a known symbol. The command returns the empty string as its result.
When ::cmdr::color is invoked with an unknown method name then this name is expected to be and treated as a list of known symbolic color names. These colors are applied to the text, with a return to base after, and the modified text is returned as the result of the command.
Note however, if the text is the empty string, then that string is returned, as the colorization would a no-op, i.e. superfluous.
If the text is not specified at all then the method returns just the application of the colors (without return to base).
An error is thrown if any of the specified color symbols are not known.
The following colors are defined by the package itself:
e30
e31
e32
e33
e34
e35
e36
e37
e39
e40
e41
e42
e43
e44
e45
e46
e47
e49
e1
e2
e3
e4
e5
e7
e8
e9
e21
e22
e23
e24
e25
e27
e28
e29
e0
=yellow
=red
=red
=magenta
=green
=blue
=blue
=red
=blue
=green
=blue
=cyan
=yellow
=green
=bold
Both the package(s) and this documentation will undoubtedly contain bugs and other problems. Please report such at Cmdr Tickets.
Please also report any ideas you may have for enhancements of either package(s) and/or documentation.
arguments, command hierarchy, command line completion, command line handling, command tree, editing command line, help for command line, hierarchy of commands, interactive command shell, optional arguments, options, parameters, processing command line, tree of commands
Copyright © 2013-2016 Andreas Kupries
Copyright © 2013-2016 Documentation, Andreas Kupries