diff --git a/CMakeLists.txt b/CMakeLists.txt index fe667e9..056c2eb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.8) -project(indicators VERSION 1.6.0 LANGUAGES CXX DESCRIPTION "Activity Indicators for Modern C++") +project(indicators VERSION 1.7.0 LANGUAGES CXX DESCRIPTION "Activity Indicators for Modern C++") option(INDICATORS_BUILD_TESTS OFF) option(SAMPLES "Build Samples" OFF) option(DEMO "Build Demo" OFF) diff --git a/README.md b/README.md index d04e3d6..556281f 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ license - version + version

@@ -71,7 +71,7 @@ int main() { option::Remainder{" "}, option::End{"]"}, option::PostfixText{"Extracting Archive"}; - option::ForegroundColor{Color::GREEN}; + option::ForegroundColor{Color::green}; }; // Update bar state @@ -115,7 +115,7 @@ int main() { option::Remainder{"-"}, option::End{" ]"}, option::PostfixText{"Loading dependency 1/4"}, - option::ForegroundColor{Color::CYAN} + option::ForegroundColor{Color::cyan} }; // Update bar state @@ -173,8 +173,8 @@ int main() { option::Lead{"█"}, option::Remainder{"-"}, option::End{"]"}, - option::PrefixText{"Training Gaze Network "}, - option::ForegroundColor{Color::YELLOW} + option::PrefixText{"Training Gaze Network 👀"}, + option::ForegroundColor{Color::yellow} option::ShowElapsedTime{true}; option::ShowRemainingTime{true}; }; @@ -217,7 +217,7 @@ int main() { option::BarWidth{80}, option::Start{"["}, option::End{"]"}, - option::ForegroundColor{Color::WHITE} + option::ForegroundColor{Color::white} }; // Update bar state @@ -263,7 +263,7 @@ int main() { option::Lead{"■"}, option::Remainder{" "}, option::End{" ]"}, - option::ForegroundColor{Color::YELLOW}, + option::ForegroundColor{Color::yellow}, option::ShowElapsedTime{true}, option::ShowRemainingTime{true}, option::PrefixText{"Progress Bar #1 "} @@ -278,7 +278,7 @@ int main() { option::Lead{">"}, option::Remainder{" "}, option::End{" ]"}, - option::ForegroundColor{Color::CYAN}, + option::ForegroundColor{Color::cyan}, option::ShowElapsedTime{true}, option::ShowRemainingTime{true}, option::PrefixText{"Progress Bar #2 "} @@ -292,7 +292,7 @@ int main() { option::Lead{"#"}, option::Remainder{" "}, option::End{" ]"}, - option::ForegroundColor{Color::RED}, + option::ForegroundColor{Color::red}, option::ShowElapsedTime{true}, option::ShowRemainingTime{true}, option::PrefixText{"Progress Bar #3 "} @@ -363,7 +363,7 @@ int main() { using namespace indicators; indicators::ProgressSpinner spinner{ option::PostfixText{"Checking credentials"}, - option::ForegroundColor{Color::YELLOW}, + option::ForegroundColor{Color::yellow}, option::SpinnerStates{std::vector{"⠈", "⠐", "⠠", "⢀", "⡀", "⠄", "⠂", "⠁"}} }; @@ -371,7 +371,7 @@ int main() { auto job = [&spinner]() { while (true) { if (spinner.is_completed()) { - spinner.set_option(option::ForegroundColor{Color::GREEN}); + spinner.set_option(option::ForegroundColor{Color::green}); spinner.set_option(option::PrefixText{"✔"}); spinner.set_option(option::ShowSpinner{false}); spinner.set_option(option::ShowPercentage{false}); diff --git a/demo/demo.cpp b/demo/demo.cpp index 084d746..389cec9 100644 --- a/demo/demo.cpp +++ b/demo/demo.cpp @@ -17,7 +17,7 @@ int main() { option::Lead{"■"}, option::Remainder{" "}, option::End{" ]"}, - option::ForegroundColor{indicators::Color::YELLOW}}; + option::ForegroundColor{indicators::Color::yellow}}; std::atomic index{0}; std::vector status_text = {"Rocket.exe is not responding", @@ -56,7 +56,7 @@ int main() { p.set_option(option::Lead{""}); p.set_option(option::Remainder{""}); p.set_option(option::End{""}); - p.set_option(option::ForegroundColor{indicators::Color::WHITE}); + p.set_option(option::ForegroundColor{indicators::Color::white}); p.set_option(option::ShowPercentage{false}); auto job = [&p]() { while (true) { @@ -86,7 +86,7 @@ int main() { p.set_option(option::Remainder{" "}); p.set_option(option::End{"]"}); p.set_option(option::PostfixText{"Getting started"}); - p.set_option(option::ForegroundColor{indicators::Color::GREEN}); + p.set_option(option::ForegroundColor{indicators::Color::green}); auto job = [&p]() { while (true) { auto ticks = p.current(); @@ -120,7 +120,7 @@ int main() { p4.set_option(option::Lead{""}); p4.set_option(option::Remainder{" "}); p4.set_option(option::End{""}); - p4.set_option(option::ForegroundColor{indicators::Color::CYAN}); + p4.set_option(option::ForegroundColor{indicators::Color::cyan}); p4.set_option(option::PostfixText{"Restoring system state"}); p4.set_option(option::ShowPercentage{false}); std::atomic index4{0}; @@ -131,7 +131,7 @@ int main() { index4 += 1; if (p4.current() + 2 >= 100) { std::cout << std::endl; - p4.set_option(option::ForegroundColor{indicators::Color::RED}); + p4.set_option(option::ForegroundColor{indicators::Color::red}); p4.set_option(option::PrefixText{"{ ERROR }"}); p4.set_option(option::Start{}); p4.set_option(option::Fill{}); @@ -162,7 +162,7 @@ int main() { option::Lead{"■"}, option::Remainder{"-"}, option::End{"]"}, - option::ForegroundColor{indicators::Color::WHITE}, + option::ForegroundColor{indicators::Color::white}, option::PostfixText{"Reverting system restore"} }; p.set_progress(100); // TODO backwards as an option? @@ -191,14 +191,14 @@ int main() { indicators::ProgressSpinner p{ option::PrefixText{""}, option::PostfixText{"Checking credentials"}, - option::ForegroundColor{indicators::Color::YELLOW}, + option::ForegroundColor{indicators::Color::yellow}, option::SpinnerStates{std::vector{"⠈", "⠐", "⠠", "⢀", "⡀", "⠄", "⠂", "⠁"}} }; auto job = [&p]() { while (true) { if (p.is_completed()) { - p.set_option(option::ForegroundColor{indicators::Color::GREEN}); + p.set_option(option::ForegroundColor{indicators::Color::green}); p.set_option(option::PrefixText{"✔"}); p.set_option(option::ShowSpinner{false}); p.set_option(option::ShowPercentage{false}); @@ -222,7 +222,7 @@ int main() { indicators::ProgressSpinner p{ option::PrefixText{" - "}, option::PostfixText{"Searching for the Moon"}, - option::ForegroundColor{indicators::Color::WHITE}, + option::ForegroundColor{indicators::Color::white}, option::ShowPercentage{false}, option::SpinnerStates{std::vector{"▖", "▘", "▝", "▗"}} }; @@ -270,7 +270,7 @@ int main() { option::Remainder{" "}, option::End{"🌑"}, option::PostfixText{"Achieved low-Earth orbit"}, - option::ForegroundColor{indicators::Color::WHITE} + option::ForegroundColor{indicators::Color::white} }; std::vector ship_trail{"⠁", "⠂", "⠄", "⡀", "⢀", "⠠", "⠐", "⠈"}; std::atomic ship_trail_index{0}; diff --git a/include/indicators/block_progress_bar.hpp b/include/indicators/block_progress_bar.hpp index dc16801..da63408 100644 --- a/include/indicators/block_progress_bar.hpp +++ b/include/indicators/block_progress_bar.hpp @@ -60,7 +60,7 @@ class BlockProgressBar { public: template ::type...>::value, void*>::type = nullptr> explicit BlockProgressBar(Args&&... args) : settings_( - details::get(option::ForegroundColor{Color::WHITE}, std::forward(args)...), + details::get(option::ForegroundColor{Color::white}, std::forward(args)...), details::get(option::BarWidth{100}, std::forward(args)...), details::get(option::Start{"["}, std::forward(args)...), details::get(option::End{"]"}, std::forward(args)...), diff --git a/include/indicators/color.hpp b/include/indicators/color.hpp index 6600124..a772dcd 100644 --- a/include/indicators/color.hpp +++ b/include/indicators/color.hpp @@ -28,5 +28,5 @@ SOFTWARE. #include namespace indicators { -enum class Color { GREY, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE }; +enum class Color { grey, red, green, yellow, blue, magenta, cyan, white }; } diff --git a/include/indicators/details/stream_helper.hpp b/include/indicators/details/stream_helper.hpp index ce6192e..931567f 100644 --- a/include/indicators/details/stream_helper.hpp +++ b/include/indicators/details/stream_helper.hpp @@ -18,28 +18,28 @@ namespace details { inline void set_stream_color(std::ostream &os, Color color) { switch (color) { - case Color::GREY: + case Color::grey: os << termcolor::grey; break; - case Color::RED: + case Color::red: os << termcolor::red; break; - case Color::GREEN: + case Color::green: os << termcolor::green; break; - case Color::YELLOW: + case Color::yellow: os << termcolor::yellow; break; - case Color::BLUE: + case Color::blue: os << termcolor::blue; break; - case Color::MAGENTA: + case Color::magenta: os << termcolor::magenta; break; - case Color::CYAN: + case Color::cyan: os << termcolor::cyan; break; - case Color::WHITE: + case Color::white: os << termcolor::white; break; default: diff --git a/include/indicators/progress_bar.hpp b/include/indicators/progress_bar.hpp index e9fc42c..8668458 100644 --- a/include/indicators/progress_bar.hpp +++ b/include/indicators/progress_bar.hpp @@ -82,7 +82,7 @@ public: details::get(option::ShowElapsedTime{false}, std::forward(args)...), details::get(option::ShowRemainingTime{false}, std::forward(args)...), details::get(option::SavedStartTime{false}, std::forward(args)...), - details::get(option::ForegroundColor{Color::WHITE}, std::forward(args)...) + details::get(option::ForegroundColor{Color::white}, std::forward(args)...) ) {} diff --git a/include/indicators/progress_spinner.hpp b/include/indicators/progress_spinner.hpp index ce83f30..aa2638a 100644 --- a/include/indicators/progress_spinner.hpp +++ b/include/indicators/progress_spinner.hpp @@ -62,7 +62,7 @@ class ProgressSpinner { public: template ::type...>::value, void*>::type = nullptr> explicit ProgressSpinner(Args&&... args) : settings_( - details::get(option::ForegroundColor{Color::WHITE}, std::forward(args)...), + details::get(option::ForegroundColor{Color::white}, std::forward(args)...), details::get(option::PrefixText{}, std::forward(args)...), details::get(option::PostfixText{}, std::forward(args)...), details::get(option::ShowPercentage{true}, std::forward(args)...), diff --git a/samples/multi_block_progress_bar.cpp b/samples/multi_block_progress_bar.cpp index 49e7521..5e8ee9a 100644 --- a/samples/multi_block_progress_bar.cpp +++ b/samples/multi_block_progress_bar.cpp @@ -5,7 +5,7 @@ int main() { using namespace indicators; BlockProgressBar bar1{ option::BarWidth{50}, - option::ForegroundColor{Color::YELLOW}, + option::ForegroundColor{Color::yellow}, option::ShowElapsedTime{true}, option::ShowRemainingTime{true}, option::PrefixText{"Progress Bar #1 "} @@ -13,7 +13,7 @@ int main() { BlockProgressBar bar2{ option::BarWidth{50}, - option::ForegroundColor{Color::CYAN}, + option::ForegroundColor{Color::cyan}, option::ShowElapsedTime{true}, option::ShowRemainingTime{true}, option::PrefixText{"Progress Bar #2 "} @@ -21,7 +21,7 @@ int main() { BlockProgressBar bar3{ option::BarWidth{50}, - option::ForegroundColor{Color::RED}, + option::ForegroundColor{Color::red}, option::ShowElapsedTime{true}, option::ShowRemainingTime{true}, option::PrefixText{"Progress Bar #3 "} diff --git a/samples/multi_progress_bar.cpp b/samples/multi_progress_bar.cpp index f621e18..d36996d 100644 --- a/samples/multi_progress_bar.cpp +++ b/samples/multi_progress_bar.cpp @@ -10,7 +10,7 @@ int main() { indicators::option::Lead{"■"}, indicators::option::Remainder{" "}, indicators::option::End{" ]"}, - indicators::option::ForegroundColor{indicators::Color::YELLOW}, + indicators::option::ForegroundColor{indicators::Color::yellow}, indicators::option::ShowElapsedTime{true}, indicators::option::ShowRemainingTime{true}, indicators::option::PrefixText{"Progress Bar #1 "} @@ -23,7 +23,7 @@ int main() { indicators::option::Lead{">"}, indicators::option::Remainder{" "}, indicators::option::End{" ]"}, - indicators::option::ForegroundColor{indicators::Color::CYAN}, + indicators::option::ForegroundColor{indicators::Color::cyan}, indicators::option::ShowElapsedTime{true}, indicators::option::ShowRemainingTime{true}, indicators::option::PrefixText{"Progress Bar #2 "} @@ -36,7 +36,7 @@ int main() { indicators::option::Lead{"#"}, indicators::option::Remainder{" "}, indicators::option::End{" ]"}, - indicators::option::ForegroundColor{indicators::Color::RED}, + indicators::option::ForegroundColor{indicators::Color::red}, indicators::option::ShowElapsedTime{true}, indicators::option::ShowRemainingTime{true}, indicators::option::PrefixText{"Progress Bar #3 "} diff --git a/samples/multi_threaded_bar.cpp b/samples/multi_threaded_bar.cpp index ed91600..6d050d7 100644 --- a/samples/multi_threaded_bar.cpp +++ b/samples/multi_threaded_bar.cpp @@ -10,7 +10,7 @@ int main() { indicators::option::Lead{"■"}, indicators::option::Remainder{"-"}, indicators::option::End{" ]"}, - indicators::option::ForegroundColor{indicators::Color::YELLOW}, + indicators::option::ForegroundColor{indicators::Color::yellow}, }; // As configured, the bar will look like this: diff --git a/samples/progress_bar_set_progress.cpp b/samples/progress_bar_set_progress.cpp index aec9d75..cc6c9b8 100644 --- a/samples/progress_bar_set_progress.cpp +++ b/samples/progress_bar_set_progress.cpp @@ -15,7 +15,7 @@ int main() { indicators::option::Remainder{"-"}, indicators::option::End{" ]"}, indicators::option::PostfixText{"Loading dependency 1/4"}, - indicators::option::ForegroundColor{indicators::Color::CYAN}, + indicators::option::ForegroundColor{indicators::Color::cyan}, }; // Update bar state diff --git a/samples/progress_bar_tick.cpp b/samples/progress_bar_tick.cpp index 8c845b3..62ad132 100644 --- a/samples/progress_bar_tick.cpp +++ b/samples/progress_bar_tick.cpp @@ -11,7 +11,7 @@ int main() { indicators::option::Remainder{" "}, indicators::option::End{" ]"}, indicators::option::PostfixText{"Getting started"}, - indicators::option::ForegroundColor{indicators::Color::GREEN}, + indicators::option::ForegroundColor{indicators::Color::green}, }; // Update bar state diff --git a/samples/progress_spinner.cpp b/samples/progress_spinner.cpp index 5db4057..b88049a 100644 --- a/samples/progress_spinner.cpp +++ b/samples/progress_spinner.cpp @@ -7,7 +7,7 @@ int main() { indicators::ProgressSpinner spinner{ indicators::option::PostfixText{"Checking credentials"}, - indicators::option::ForegroundColor{indicators::Color::YELLOW}, + indicators::option::ForegroundColor{indicators::Color::yellow}, indicators::option::SpinnerStates{std::vector{"⠈", "⠐", "⠠", "⢀", "⡀", "⠄", "⠂", "⠁"}}, }; @@ -15,7 +15,7 @@ int main() { auto job = [&spinner]() { while (true) { if (spinner.is_completed()) { - spinner.set_option(indicators::option::ForegroundColor{indicators::Color::GREEN}); + spinner.set_option(indicators::option::ForegroundColor{indicators::Color::green}); spinner.set_option(indicators::option::PrefixText{"✔"}); spinner.set_option(indicators::option::ShowSpinner{false}); spinner.set_option(indicators::option::ShowPercentage{false}); diff --git a/samples/time_meter.cpp b/samples/time_meter.cpp index 04542be..4a8a79f 100644 --- a/samples/time_meter.cpp +++ b/samples/time_meter.cpp @@ -10,8 +10,8 @@ int main() { indicators::option::Lead{"█"}, indicators::option::Remainder{"-"}, indicators::option::End{"]"}, - indicators::option::PostfixText{"Training Gaze Network "}, - indicators::option::ForegroundColor{indicators::Color::YELLOW}, + indicators::option::PrefixText{"Training Gaze Network 👀"}, + indicators::option::ForegroundColor{indicators::Color::yellow}, indicators::option::ShowElapsedTime{true}, indicators::option::ShowRemainingTime{true}, };