-
Notifications
You must be signed in to change notification settings - Fork 25
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
1.1.1 working #26
Merged
Merged
1.1.1 working #26
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Added function to convert a number to a String so that all of the subclasses could use. The idea is to call this function with guard instead of using an if-else statement and nesting the other code that depends on the String. There are also two constants defined with this change that are used for determining the number of digits after the decimal place when formatting a number as a String. One is used for alpha values and the other for colour fractions (colours who have values represented between 0 and 1).
Using the guard statement to clean up the code. The alpha value now gets formatted before being printed so it doesn’t have a long string of numbers after the decimal point.
Breaking out common parts of regular expressions and storing them into variables so that they only need to be changed in one place. I’ve also found that there were some inconsistencies in how some things were searched for in between different seekers so this will resolve that. All basic search elements, such as how to find a float between 0 and 1, will be defined in Seeker. This is then used in all of the sub-classes in a consistent manner. If it needs to be changed it’s done in one place and everything else sees that change right away.
Also added support for “.init” to match.
The latest release of the Rainbow-Creator module added a function that aids in creating HSB colours and this update supports that function in ColorSenseRainbow.
It was writing the complete value of alpha no matter how many decimal places it was before and now it uses a number formatter to truncate it to the proper number of decimal places (defined to be two currently).
Also defined a new constant for integer values between 0 and 299 inclusive.
It’s only used in this class so this was the better place to define it. A comment was made in the superclass that it exists here to stop someone from creating a duplicate in the future.
Also changed some constants with respect to the regular expressions in Seeker.swift.
The number of decimal places in the formatting of the numbers is now correct. Before it was using the value for the alpha formatting for the other numbers and it wasn’t formatting the alpha value at all.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.