Generate beautiful random gradients
$ npm install --save random-gradient
// with React
import gradient from 'random-gradient'
export default ({ name }) => {
const bgGradient = { background: gradient(name) }
return (
<div style={bgGradient}>
<h2>{name}</h2>
</div>
)
}
// 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);
}
});
Type: string
Required
Type: string
Default: diagonal
Options: diagonal
, vertical
, horizontal
, radial
MIT © Bu Kinoshita