Skip to content

improve getColorTint util to support custom colors tints #257

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

Merged
merged 4 commits into from
Oct 14, 2018

Conversation

ethanshar
Copy link
Collaborator

No description provided.

@ethanshar ethanshar requested a review from Inbal-Tish October 14, 2018 13:10
const colorKey = _.findKey(this, (value, key) => this[key] === color);

if (_.isUndefined(tintKey)) {
throw new Error('"Colors.getColorTint" must accept a color and tintKey params');
console.error('"Colors.getColorTint" must accept a color and tintKey params');
Copy link
Collaborator

Choose a reason for hiding this comment

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

If you don't return here you might use the undefined 'tintKey' later

return color;
} else if (tintLevel <= BASE_COLOR_LEVEL) {
const darkRatio = darkRatios[tintLevel - 1];
return one(color).darken(darkRatio).hex();
Copy link
Collaborator

Choose a reason for hiding this comment

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

What if 'color' is undefined? Won't it crash here?

@Inbal-Tish Inbal-Tish merged commit 25e88fb into master Oct 14, 2018
@ethanshar ethanshar deleted the getColotTint branch April 22, 2019 12:54
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