-
Notifications
You must be signed in to change notification settings - Fork 406
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
Exclude colors or hues #58
Labels
Comments
Excluding a certain hue would be a good first step. Is this currently possible? |
I prefer this option as well! Are there any plans to develop this new feature? |
Great idea, would be nice to have in this lib |
I had problem with colors sometimes not dark enough when using dark luminosity (or colors not light enough), so I excluded specific problematic colors something like this for now: function getColor(luminosity, seed) {
const excludes = [
"#b21051",
"#78ed9f"
];
let color = randomColor({
luminosity: luminosity,
seed: seed
});
while (excludes.includes(color)) {
color = randomColor({ luminosity: luminosity });
}
return color;
}
// use
getColor("dark", "whatever"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Extend the functionality to generate
N
(distinct) colors with a list ofexcludes
that must not appear among the generated set. A typical example would be "background color" and "text color" (B&W).The excludes should be considered as a part of the colors during the generation process, so the new colors are as far as possible from each other as well from the excludes, this is done in #50
The text was updated successfully, but these errors were encountered: