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

Coloured negative numbers support #98

Merged

Conversation

rlewicki
Copy link
Contributor

Hey, following commits contain:

  • small fix to also accept whitespaces at the end of an integer in the regex inside is_integer function
  • new function that wraps both is_integer and is_double
  • new function that checks whether given string is a negative number (either integer or double)
  • negative number colour definition for each colour scheme

In the issue #71 @alexhallam you mentioned "add an option". Does this mean you would prefer this to be an optional parameter in the command line? If so, what would the name and short for it be? I'm having a hard time figuring one out 😄

Also, red colour was already used for a NA values so I've used other tone of red if a given scheme had one, otherwise I would use any other colour that is not used. I'm attaching pictures with each scheme presenting how they look like. Let me know if you would rather use other universal colour for all schemes? If not, could you please suggest other tints I can use for that?

Thanks for any feedback up front 🖖

@alexhallam
Copy link
Owner

I am really excited for this. I just cloned to try it out. I am curious if you are seeing the same coloring I am seeing. Only the first row of negatives are colored

image

@rlewicki
Copy link
Contributor Author

Yeah, you are right, there is something off with detecting negative numbers when there is more than one column with numbers. I obviously used a trivial example and assumed it work, silly me 😛 I'll look into it using your example.

Also, I forgot to attach pictures with different colour schemes in original post, sorry.

  1. Nord
    nord-colour-scheme
  2. OneDark
    one-dark-colour-scheme
  3. Gruvbox
    gruvbox-colour-scheme
  4. Dracula
    dracula-colour-scheme

@alexhallam
Copy link
Owner

looks great!

@rlewicki
Copy link
Contributor Author

I've submitted fix to the case you pointed out. The problem was that sometimes there are whitespaces at the beginning of a text as well. Also f64::from_str was failing due to whitespaces as well, trimming text fixed the issue.
Here is example:
example

@rlewicki
Copy link
Contributor Author

@alexhallam I also added tests to cover both new functions just in case. I noticed that @Lireer in #99 added new test section specific for datatypes while I did that in the main file. It might be worth to merge his change first, then I'll move my tests there as well to avoid conflicts.

@alexhallam
Copy link
Owner

Just wanted to say thanks for all of the issues you have been helping out with. I am reviewing this PR now.

Copy link
Owner

@alexhallam alexhallam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trim() is a good idea. Thanks for adding tests!

@alexhallam alexhallam merged commit c609ea4 into alexhallam:main Oct 18, 2021
alexhallam added a commit that referenced this pull request Oct 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants