Update available colors, remove newline rtrim from ptln, and add new print function #27
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
So let me know your thoughts on this:
This PR implements a few changes:
1.) Update available colors
So as the project is right now, some of the colors are kind of one wouldn't normally expect with terminal colors (like if you normally use https://www.npmjs.com/package/colors in Node), for example, Yellow=Brown, Light Yellow = Yellow, Magenta = Purple, Light Magenta = Light Purple. I updated the colors to match what is defined here: https://www.lihaoyi.com/post/BuildyourownCommandLinewithANSIescapecodes.html
I also added background colors as well as bold, underline, and reversed styles. I understand this is a breaking change but I think it would be worth it.
2.) Remove newline rtrim from the ptln function
Right now the function trims any new line characters from the end of the text making it not possible to add an empty line to text unless you call the function again with an empty string.
3.) Add new print function
I wasn't sure what to call this function, originally I named it
format
however that doesn't imply that the text will be printed on the screen and I didn't want to have to wrap this function in ptln (which wouldn't even really be possible because that function requires you to define a color). But basically this function allows you to use color codes to combine difference colors easily. For example:Instead of throwing an error if someone puts an invalid color code, it just treats it as normal text.
Let me know what you think!