Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brandoncorbin/string_to_color
Consistently generate the same color for a specific string
https://github.com/brandoncorbin/string_to_color
Last synced: 17 days ago
JSON representation
Consistently generate the same color for a specific string
- Host: GitHub
- URL: https://github.com/brandoncorbin/string_to_color
- Owner: brandoncorbin
- License: apache-2.0
- Created: 2014-06-06T13:02:11.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2018-11-07T20:50:33.000Z (about 6 years ago)
- Last Synced: 2024-11-11T02:15:09.671Z (about 2 months ago)
- Language: HTML
- Size: 14.6 KB
- Stars: 49
- Watchers: 6
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DEAD PROJECT WARNING
This project is no longer maintained, check out some of the forks. Or, I recommend string-to-color
String to Color
===============Tiny library to generate the same nice hex color for a string in Javascript.
###Features
- Sexy colors, not muddy browns and boring grays
- Binary safe
- Only 0.5kb minified### Why it needed to exist
I needed a way to generate a consistent NICE color for any given word to assign a tag it's own independent color (without knowing what all tags are).
### How to use it
var color = '#'+string_to_color('Some String');
alert(color);Optionally, you can pass a percentage to lighten/darken the shade. The default value is -10.
var lighterColor = '#'+string_to_color('Some String', 40);
alert(lighterColor);###Demo
http://icorbin.com/code/string_to_color/example.html