mirror of
https://github.com/mhx/dwarfs.git
synced 2025-09-17 08:18:07 -04:00
Bit more color
This commit is contained in:
parent
4da9055cfb
commit
d48dcc0604
@ -50,4 +50,7 @@ bool stream_is_fancy_terminal(std::ostream& os);
|
||||
|
||||
char const* terminal_color(termcolor color);
|
||||
|
||||
std::string
|
||||
terminal_colored(std::string text, termcolor color, bool enable = true);
|
||||
|
||||
} // namespace dwarfs
|
||||
|
@ -155,7 +155,8 @@ void console_writer::update(const progress& p, bool last) {
|
||||
switch (mode_) {
|
||||
case NORMAL:
|
||||
if (fancy) {
|
||||
oss << p.status(width_) << newline;
|
||||
oss << terminal_colored(p.status(width_), termcolor::BOLD_CYAN, color_)
|
||||
<< newline;
|
||||
}
|
||||
|
||||
oss << p.dirs_scanned << " dirs, " << p.links_scanned << "/"
|
||||
|
@ -69,4 +69,10 @@ char const* terminal_color(termcolor color) {
|
||||
return colors.at(static_cast<size_t>(color));
|
||||
}
|
||||
|
||||
std::string terminal_colored(std::string text, termcolor color, bool enable) {
|
||||
return enable
|
||||
? terminal_color(color) + text + terminal_color(termcolor::NORMAL)
|
||||
: text;
|
||||
}
|
||||
|
||||
} // namespace dwarfs
|
||||
|
Loading…
x
Reference in New Issue
Block a user