hashcolor.cr
Hashcolor
Generate color from a given string.
Hashcolor generates a color for a given string using full RGB range or using a limited set of colors.
Installation
Add this to your application's shard.yml:
dependencies:
hashcolor:
github: hugoabonizio/hashcolor.cr
Usage
require "hashcolor"
puts Hashcolor.generate("Hello world") # => 0179A4
Hashcolor.colors = ["006064", "8BC34A", "FF9800"]
Hashcolor.generate("hugo") # => 8BC34A
# Using explicitly
Hashcolor.generate_random("hugo") # => B2F9FF
Hashcolor.generate_set("hugo") # => 006064
Examples
| String | Generated |
|---|---|
Hashcolor.generate("Hello world") |
|
Hashcolor.generate("Hello world!") |
|
Hashcolor.generate("hugo@email.com") |
|
Hashcolor.generate("D6772A") |
Contributing
- Fork it ( https://github.com/hugoabonizio/hashcolor.cr/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
Contributors
- hugoabonizio Hugo Abonizio - creator, maintainer
Repository
hashcolor.cr
Owner
Statistic
- 1
- 0
- 0
- 0
- 0
- almost 9 years ago
- May 21, 2017
License
MIT License
Links
Synced at
Tue, 27 Jan 2026 09:32:51 GMT
Languages