2.0.0 • Published 4 years ago

@davidcmeier/string-to-color v2.0.0

Weekly downloads
9
License
MIT
Repository
github
Last release
4 years ago

String To Color

Oh, do you need to assign a color to your user? This is your solution (music on :P) Just introduce a string and get the color value in Hex (or RGB)

How to use šŸš€

Just install the library (or copy the code if you want)

npm install @davidcmeier/string-to-color

and write the magic words:

stringToColor('cool cool cool!')

and with this you will get #cececf

That's all?

No! You can also get the value in RGB!

stringToColor('cool cool cool!', config: {output: 'RGB'})

returns Object { red: 206, green: 206, blue: 207 }

In case you need to limit the numbers (if you don't want a #000000 of #FFFFFF) just do the following!

const limits: LimitColor = {
  blue: { min: 100, max: 150},
  green: { min: 100, max: 150},
  red: { min: 100, max: 150},
}
stringToColor('cool cool cool!', {limitColor: limits})

returns #6f6f70

Contribute šŸ–‡ļø

Feel free to contribute

License šŸ“„

This project is under MIT License - look at the file LICENSE.md for more details.


āŒØļø with ā¤ļø DavidCMeier 😊

2.0.0

4 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.0.10

5 years ago

0.0.12

5 years ago

1.0.3

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago