diff --git a/progress.cpp b/progress.cpp index da156ce..71ef1a7 100644 --- a/progress.cpp +++ b/progress.cpp @@ -9,17 +9,17 @@ void show_rows_cols(const sc::term& t) { void show_progress(const sc::term& t) { struct timespec tm; - tm.tv_nsec = 20000000; + tm.tv_nsec = 10000000; tm.tv_sec = 0; sc::cursor_hider ch {STDERR_FILENO}; for (int i = 0; i < 1000; ++i) { - t.progress(8, "progress", i, 1000); + t.progress(12, "progress bar", i, 1000); nanosleep(&tm, nullptr); } std::cerr << std::endl; } -void show_hue_bar(const sc::term& t, int top) { +void show_hue_bar(int top) { int r = top; int g = 0; int b = 0; @@ -52,30 +52,74 @@ void show_hue_bar(const sc::term& t, int top) { while (b >= 0) { std::cerr << sc::io::rgbb(r, g, b--) << ' '; } - t.reset(); - std::cerr << std::endl; + std::cerr << sc::io::reset << std::endl; } -void show_hue_bars(const sc::term& t) { +void show_hue_bars() { for (int top = 1; top < 6; ++top) { - show_hue_bar(t, top); + show_hue_bar(top); } } -void show_grayscale_bar(const sc::term& t) { +void show_grayscale_bar() { for (int i = 0; i < 23; ++i) { std::cerr << sc::io::grayb(i) << ' '; } - t.reset(); - std::cerr << std::endl; + std::cerr << sc::io::reset << std::endl; +} + +void show_words() { + std::cout << sc::io::redf << " red "; + std::cout << sc::io::greenf << " green "; + std::cout << sc::io::bluef << " blue "; + std::cout << sc::io::cyanf << " cyan "; + std::cout << sc::io::magentaf << " magenta "; + std::cout << sc::io::yellowf << " yellow "; + std::cout << sc::io::rgbf(5, 2, 0) << " orange "; + std::cout << sc::io::bold << std::endl; + std::cout << sc::io::redf << " red "; + std::cout << sc::io::greenf << " green "; + std::cout << sc::io::bluef << " blue "; + std::cout << sc::io::cyanf << " cyan "; + std::cout << sc::io::magentaf << " magenta "; + std::cout << sc::io::yellowf << " yellow "; + std::cout << sc::io::rgbf(5, 2, 0) << " orange "; + std::cout << sc::io::reset << std::endl; + std::cout << sc::io::blackf; + std::cout << sc::io::redb << " red "; + std::cout << sc::io::greenb << " green "; + std::cout << sc::io::blueb << " blue "; + std::cout << sc::io::cyanb << " cyan "; + std::cout << sc::io::magentab << " magenta "; + std::cout << sc::io::yellowb << " yellow "; + std::cout << sc::io::rgbb(5, 2, 0) << " orange "; + std::cout << sc::io::bold << std::endl; + std::cout << sc::io::redb << " red "; + std::cout << sc::io::greenb << " green "; + std::cout << sc::io::blueb << " blue "; + std::cout << sc::io::cyanb << " cyan "; + std::cout << sc::io::magentab << " magenta "; + std::cout << sc::io::yellowb << " yellow "; + std::cout << sc::io::rgbb(5, 2, 0) << " orange "; + std::cout << sc::io::reset << std::endl; + std::cout << sc::io::bold << "bold " << sc::io::reset; + std::cout << sc::io::italic << "italic " << sc::io::reset; + std::cout << sc::io::underline << "underline" << sc::io::reset << ' '; + std::cout << sc::io::strikethru << "strike thru" << sc::io::reset << ' '; + std::cout << sc::io::overline << "overline" << sc::io::reset << ' '; + std::cout << sc::io::reverse << "reverse" << sc::io::reset << ' '; + // std::cout << sc::io::blinkslow << "blink slowly " << sc::io::reset; + // std::cout << sc::io::blinkfast << "blink fast " << sc::io::reset; + std::cout << std::endl; } int main() { sc::term term {STDERR_FILENO}; try { show_rows_cols(term); - show_grayscale_bar(term); - show_hue_bars(term); + show_grayscale_bar(); + show_hue_bars(); + show_words(); show_progress(term); } catch (const std::exception& ex) { term.reset();