Added functions that helps in finding more contrasting colors #1386
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.
I added 3 color functions:
*invertluma(color)
This function inverts the luma component of a color. If its luma was 27%, it will be 73%
*contrastmore( color1, color2, minLumaDIfference = 30% )
This function is very usefull when you need color2 to be legible against color1 (based on luma).
If color2 and color1 have a luma less than minLumaDIfference (30% default), color2 will be moved far away in luminance from color1.
If the resulting color2 luma is more than 1 or less than 0, its pivoted around color1, so the resulting color will be "near" than color1.
*autocontrast( color1, color2, minLumaDIfference = 30% )
This function is similar than contrastmore and is very usefull when you need color2 to be legible against color1 (based on luma).
If color2 and color1 have a luma less than minLumaDIfference (30% default), color2 will be moved far away in luminance from color1.
If the resulting color2 luma is more than 1 or less than 0, its luma gets INVERTED, so the resulting color2 luma will be far away from color1 luma.
It works better than contrastmore for buttons colors (background color and text color)