hydroctext Namespace Reference
Simple text colours on the Linux terminal, using escape-codes.
More...
Classes |
struct | Style |
| Combines attribute and colour into one structure. More...
|
Enumerations |
enum | Attribute {
Bold = 1,
Dim = 2,
Underline = 4,
Blink = 5,
Reverse = 7,
NormalAttributes = 22
} |
| Text attribute.
More...
|
enum | Colour {
Black = 0,
Red = 1,
Green = 2,
Yellow = 3,
Blue = 4,
Magenta = 5,
Cyan = 6,
White = 7,
DefaultColour = 9
} |
| Text colour.
More...
|
Functions |
std::string | reset () |
| Returns a string with the escape-codes required to return the display to default values.
|
std::string | set (Attribute attr, Colour fg, Colour bg) |
std::string | set (const Style &style) |
| Convenience function, behaves the same as the above.
|
std::string | emph (const std::string &s, const Style &emph) |
std::string | emph (const std::string &s, const Style &emph, const Style &main) |
std::string | toFixedWidth (const std::string &s, int w) |
Detailed Description
Simple text colours on the Linux terminal, using escape-codes.
This namespace is part of a library libHydroColourText.
Enumeration Type Documentation
Text attribute.
- Enumerator:
Bold |
Bold.
|
Dim |
Dim.
|
Underline |
Underline.
|
Blink |
Blink.
|
Reverse |
Reverse.
|
NormalAttributes |
Normal.
|
Text colour.
- Enumerator:
Black |
Black.
|
Red |
Red.
|
Green |
Green.
|
Yellow |
Yellow.
|
Blue |
Blue.
|
Magenta |
Magenta.
|
Cyan |
Cyan.
|
White |
White.
|
DefaultColour |
Default.
|
Function Documentation
std::string hydroctext::emph |
( |
const std::string & |
s, |
|
|
const Style & |
emph, |
|
|
const Style & |
main | |
|
) |
| | |
Adds escape codes before and after the supplied string so that it is displayed using Style emph but the following text is displayed with Style main.
- See also:
- set()
std::string hydroctext::emph |
( |
const std::string & |
s, |
|
|
const Style & |
emph | |
|
) |
| | |
Adds escape codes before and after the supplied string so that it is displayed using Style emph but the following text is displayed with default style (this is achieved by calling reset()).
- See also:
- set()
std::string hydroctext::set |
( |
Attribute |
attr = NormalAttributes , |
|
|
Colour |
fg = DefaultColour , |
|
|
Colour |
bg = DefaultColour | |
|
) |
| | |
Returns a string with escape codes which will change the style of terminal output. This style will persist until another change is made or the style is reset.
- See also:
- emph()
std::string hydroctext::toFixedWidth |
( |
const std::string & |
s, |
|
|
int |
length | |
|
) |
| | |
Truncates or pads the string to the specified length The string may contain escape codes: they will not be counted