Repository navigation
Improve theme-color-level() using abs() - #24074
Merged
Merged
Conversation
Improve `theme-color-level()` using `abs()`. `abs()` gets the absolute value of `$level`. That way, `if/else` statement can be completely eliminated.
houndci-bot
reviewed
Sep 24, 2017
| @return mix($color-base, $color, $level * $theme-color-interval); | ||
| } | ||
| $level: abs($level); | ||
|
|
Member
|
/CC @andresgalante |
Collaborator
|
@XhmikosR I'll build this one and test it out but I can't be definitive about it because I am not great with scss functions. |
XhmikosR
approved these changes
Sep 26, 2017
XhmikosR
left a comment
Member
There was a problem hiding this comment.
I think it totally makes sense to use abs here, but please someone else confirm too.
Collaborator
|
I've pull @schwastek branch, build it locally and tested changing the themes maps on variables. It works and compiles without errors. As I mention before I can't say for sure, but to me the absolut method makes sense. @schwastek great work! 👍 |
Closed
This file contains hidden or 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
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.
Concerns function
theme-color-level()in_functions.scssfile.Use internal Sass function
abs()to get the absolute value of$levelargument.That way,
if/elsestatement can be completely eliminated.Screenshot
Both - old and new functions - return the same values.
Test
Check out this pull request locally or reproduce it from scratch:
scriptssection inpackage.jsonwith:_functions.scss:_debug.scss: