Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add built-in ANSI escape code shortcut combinations and custom terminal output #1

Open
alexwkleung opened this issue Aug 31, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@alexwkleung
Copy link
Owner

Plan on adding built-in ANSI escape code shortcut combinations such as bold and underlined foreground/background colours (8/16 colours; not 256 colours). It would be nice to have the option to have shortcuts for these combinations so the syntax doesn't become verbose and tedious.

Here are some examples of shortcut combinations:

#include "termstylist.h"
#include <iostream>

int main() {
  std::cout << termstylist::Bold_FG_Cyan << "Bold Cyan!" << termstylist::RESET_Default << '\n';

  return 0;
}
#include "termstylist.h"
#include <iostream>

int main() {
   std::cout << termstylist::Bold_Underline_FG_Magenta <<  "Bold Underline Magenta!" << termstylist::RESET_Default << '\n';

   return 0;
}

An example of what the shortcut combinations would replace (as shortcut options, to eliminate verbose syntax):

#include "termstylist.h"
#include <iostream>

int main() {
    std::cout << termstylist::ATTRS_Bold << termstylist::ATTRS_Underline << termstylist::FG_Yellow << "Bold Underline Yellow!" << termstylist::RESET_Default << '\n';

   return 0;
}

Also, custom terminal output such as coloured loading/percent bars would also be good to have for niche versatility of the library.

Here's an example of what that could look like (syntax wise):

#include "termstylist.h"
#include <iostream> 

int main() {
   std::cout << "This is a loading bar!" << '\n' << termstylist::GreenLoadingBar << std::flush;

   return 0;
}

If any of these features are going to be added, make sure to add unit tests for them whenever possible.

@alexwkleung alexwkleung added the enhancement New feature or request label Aug 31, 2022
@alexwkleung alexwkleung self-assigned this Aug 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant