Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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