Skip to content
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

Feat/custom colour #12

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Feat/custom colour #12

wants to merge 5 commits into from

Conversation

sericaia
Copy link

Support for custom color lists (multiple)

This is an alternative to #8

@vegeta897
Copy link

It should probably be noted that this would allow overwriting the built-in lists in addition to adding new ones, just by using the same name (e.g. namer.addList('basic', myBasicColors)). This behavior may be unintended by someone who isn't aware of the default list names.

Copy link

@alexgrigore1 alexgrigore1 left a comment

Choose a reason for hiding this comment

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

Actually, I just realized the library can accept a custom list of colors without any changes. It has the lists property exported. It is a simple object which can be extended with whatever list of colors you need. Here is an example:

import colorNamer from "color-namer";
colorNamer.lists.myCustomList = [
    { name: "myColor1", hex: "#F5F5DC" },
    { name: "myColor2", hex: "#FF00FF" },
...    
];
const { myCustomList } = colorNamer("rgb(50,30,70)", { pick: ["myCustomList"] });

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.

3 participants