-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Replace tinycolor2 with colord on the bocks package. #35165
Replace tinycolor2 with colord on the bocks package. #35165
Conversation
Size Change: -1.28 kB (0%) Total Size: 1.06 MB
ℹ️ View Unchanged
|
@@ -1,8 +1,10 @@ | |||
/** | |||
* External dependencies | |||
*/ | |||
import { every, has, isFunction, isString, reduce } from 'lodash'; | |||
import { default as tinycolor, mostReadable } from 'tinycolor2'; | |||
import { every, has, isFunction, isString, reduce, maxBy } from 'lodash'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious if this increase in lodash usage counterweights the benefits of colord
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still good to keep an eye on if there was an intention to reduce the use of lodash
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess in this case we can easily avoid the maxBy and use a reduce. But maxBy makes the code more clear (it becomes easy to do what the function is doing) and it internally probably just uses a reduce anyway so the saving would not be noticeable.
760c08c
to
2ff2db6
Compare
This PR tinycolor2 with colord on the blocks package.
How has this been tested?
I used the same test block (https://gist.github.com/jorgefilipecosta/2dd281f9f5f078258f7c8d4ba4cc34cd) created when the icon color functionality was added (on #7068) and verified things still work.