Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bukinoshita/random-gradient
Generate beautiful random gradients
https://github.com/bukinoshita/random-gradient
gradient javascript nodejs
Last synced: about 2 months ago
JSON representation
Generate beautiful random gradients
- Host: GitHub
- URL: https://github.com/bukinoshita/random-gradient
- Owner: bukinoshita
- License: mit
- Created: 2017-06-06T20:27:07.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-03T18:28:11.000Z (over 1 year ago)
- Last Synced: 2024-07-17T05:46:30.153Z (2 months ago)
- Topics: gradient, javascript, nodejs
- Language: JavaScript
- Homepage:
- Size: 451 KB
- Stars: 71
- Watchers: 2
- Forks: 4
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# random-gradient [![Build Status](https://travis-ci.org/bukinoshita/random-gradient.svg?branch=master)](https://travis-ci.org/bukinoshita/random-gradient)
> Generate beautiful random gradients
## Install
```
$ npm install --save random-gradient
```## Usage
```js
// with Reactimport gradient from 'random-gradient'
export default ({ name }) => {
const bgGradient = { background: gradient(name) }return (
{name}
)
}// with Vue
import gradient from 'random-gradient'
Vue.directive('random-gradient', {
inserted: function (el) {
// Using the element's "title" attribute, e.g.
el.style.backgroundImage = gradient(el.title);
}
});
```## API
### randomGradient(uid, type)#### uid
Type: `string`
Required#### type
Type: `string`
Default: `diagonal`
Options: `diagonal`, `vertical`, `horizontal`, `radial`## Related
- [hash-avatar](https://github.com/bukinoshita/hash-avatar) — :rainbow: Hash avatar algorithm
- [react-hash-avatar](https://github.com/bukinoshita/react-hash-avatar) — React hash avatar algorithm## License
[MIT](https://github.com/bukinoshita/random-gradient/blob/master/LICENSE) © Bu Kinoshita