Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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 React

import 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