Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/matthiasunt/hash-color-material
Hashes a string or a number to a material color hex code.
https://github.com/matthiasunt/hash-color-material
color colors hash-functions material-color-hex material-colors npm npm-package
Last synced: about 2 months ago
JSON representation
Hashes a string or a number to a material color hex code.
- Host: GitHub
- URL: https://github.com/matthiasunt/hash-color-material
- Owner: matthiasunt
- License: other
- Created: 2018-02-05T14:45:30.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2020-12-14T11:30:33.000Z (about 4 years ago)
- Last Synced: 2024-11-14T11:11:35.660Z (about 2 months ago)
- Topics: color, colors, hash-functions, material-color-hex, material-colors, npm, npm-package
- Language: JavaScript
- Homepage:
- Size: 8.79 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# hash-color-material
Hashes a string or a number to a [material color](https://material.io/guidelines/style/color.html#color-color-palette) hex code.## Get started
First:
```
npm install hash-color-material
```
Then:
```
var hashColor = require('hash-color-material');
console.log(hashColor.getColorFromString('Hello world!'));
```
## Usage
```
hashColor.getColorFromString('Hello world!');
```
The result is: `#039BE5`## Functions
```
hashColor.getColorFromString(str, darkColors, accentColors)
```
Hashes the passed string to a material color hex code.
* `str` (string): The string which gets hashed to a material color hex code
* `darkColors` (boolean): Whether to include brown, grey and blue-grey (optional, default: true)
* `accentColors` (boolean): Whether to include accent colors (optional, default: true)```
hashColor.getColorFromNumber(number, darkColors, accentColors)
```
Hashes the passed string to a material color hex code.
* `number` (number): The number which gets hashed to a material color hex code
* `darkColors` (boolean): Whether to include brown, grey and blue-grey (optional, default: true)
* `accentColors` (boolean): Whether to include accent colors (optional, default: true)